HTML and CSS Reference
In-Depth Information
Server
Client
0s
Time
10s
Figure 1-2. Polling sends HTTP requests frequently to check for new information
To better understand just how wasteful this can be, you can think of this communication as a conversation
between the client and server:
CLIENT: Hi! Can I have some data?
SERVER: Sure. Here you go!
[time passes]
CLIENT: Do you have any new data for me?
SERVER: No.
[time passes]
CLIENT: Do you have any new data for me?
SERVER: No.
[time passes]
CLIENT: Do you have any new data for me?
SERVER: No.
[time passes]
CLIENT: Do you have any new data for me?
SERVER: I do! Here you go!
Just like real life, conversations like these between the client and server are both annoying and not very productive.
Although this polling solution is definitely a start, it has its shortcomings. Most notably, it creates a lot of empty
requests, which create a lot of unnecessary overhead for an app. That overhead can prevent an app from scaling well:
if an app polls once a second for new data, and 100,000 users are all using the app simultaneously, that's 6,000,000
requests per minute.
If you take into account the overhead of each HTTP request—in a test by Peter Lubbers, each request/response
totaled 871 bytes 6 —there's a lot of extra information being sent back and forth just to find out that nothing new has
happened on the server.
6
http://soa.sys-con.com/node/1315473
 
Search WWH ::




Custom Search