Skip to content

Task 18: Aggressive Fixed Interval Polling Risks Overwhelming the Replay Server #314

Description

@grantfox-oss

Once a simulation job is successfully submitted to the server, the client must actively poll the server to determine when the job has finished executing. Naive implementations often use setInterval with an aggressive fixed frequency (e.g., polling every 100 milliseconds). In a production environment with multiple clients, this aggressive polling creates a massive tidal wave of requests that can easily overwhelm the server, leading to CPU exhaustion, socket starvation, and ultimately a self inflicted Denial of Service (DoS) attack. A sophisticated client must respect server load and network bandwidth constraints.

Issues/what to fix

We must construct an intelligent, recursive polling engine using setTimeout (which, unlike setInterval, prevents request overlapping if network latency spikes). The polling engine must implement an Exponential Backoff strategy. It should initiate its first status check at a rapid 500ms delay. If the API returns that the job is still "queued", the engine must mathematically double the delay time for the subsequent request (e.g., 500ms, then 1000ms, then 2000ms), up to a predetermined maximum ceiling (e.g., capping the delay at 5000ms). This algorithm ensures rapid feedback for fast jobs, while exponentially reducing network pressure for long running, complex simulation tasks.

Files location

examples/api clients/mock replay submitter/index.js

Expected result

The polling script will elegantly and intelligently query the server, dynamically adjusting its request frequency on the fly based on the job's duration. It will minimize unnecessary network traffic and CPU overhead, acting as a model citizen within the distributed architecture.

Contributor telegram group

https://t.me/+sII7WPhll2liMGNk

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions