Ajax Polling with 1000 Chat Users
We want to have an ajax call execute every 100 seconds that requests a boolean value from the database that tells the client side if the user is still authorized to ask questions.
I'm afraid that even though this 开发者_如何学运维is a very small amount of data being requested that it might be too much for the database..
Worst case scenerio, 1000 users make this request at the same time. The database max pool size is 1000.
This is an ASP.NET application using Page Methods accessed via javascript callback functions.
Why not randomize the delay? E.g poll not every 100 seconds but every 100+some_random_offset seconds. This way, you are guaranteed that you won't have 1000 clients ALWAYS polling at the same exact time, though you might see random occasional spikes.
You can look into having a caching layer on top of the database, which can handle this load nicely, since you don't have to hit the DB everytime.
精彩评论