I'm using APE-Project,
Is it better to have 10,000 connected users or 10,000 pages that use a setInterval()
to send each N milliseconds a request to a PHP page?
Thanks
In case of time intensive synchronous operations, setTimeInterval may break the rhythm. Also, if any error occurs in setInterval code block, it will not stop execution but keeps on running faulty code. Not to mention they need a clearInterval function to stop it.
Usage notes. The setInterval() function is commonly used to set a delay for functions that are executed again and again, such as animations. You can cancel the interval using clearInterval() . If you wish to have your function called once after the specified delay, use setTimeout() .
Not appreciably. You'd have to be doing something extremely heavy in each interval for it to affect performance, and that would be true without setInterval involved at all.
setInterval will run the function sendMessage every second (1000 ms).
APE claims it can scale upto 100k connections per machine. It's using proper evented I/O so it just scales becuase it doesn't have one thread/process per connection.
Just use 10000 connected clients with web sockets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With