Menu

Rate Limiting a Real-Time Odds Feed Without Dropping Critical Updates
πŸ“°

Rate Limiting a Real-Time Odds Feed Without Dropping Critical Updates

DEV Community: backendΒ·desgh whiteΒ·about 3 hours ago
#uhtW0QcA
#devtobackend#devto#dev#cosmetic#critical
Reading 0:00
15s threshold

An odds feed can push several hundred messages per second during peak events. The UI only needs to repaint at ~60 fps, so most messages are redundant β€” but you cannot simply throttle the socket, because a market suspension or a sudden line move has to reach the user instantly.

Two-tier filtering

Split incoming messages into critical (suspensions, settlement, line moves beyond a threshold) and cosmetic (minor price ticks). Critical messages bypass the buffer and render immediately; cosmetic ones coalesce in a frame-aligned batch:

const THRESHOLD_CENTS = 5 ;

function classify ( msg : OddsUpdate ) : 'critical' | 'cosmetic' { if ( msg . suspended || msg . settled ) return 'critical' ; if ( Math . abs ( msg . newPrice - msg .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.