V.2The polling problem
Roberto Bifulco — Mon, 02/11/2008 - 15:06
HTTP uses the request-response model, where only the client can start a communication. This is a problem for a chat service that needs to fire messages to the chat user every time a message is added, which is an asynchronous event. So, to get an update a client must request it.
This is a problem for two reasons:
The client doesn't know when a new message is on chat;
Requests for update can be not useful because there is no new messages on chat.
The solution in these case is the using of a polling algorithm, that must resolve a trade off between the time to update the user's chat, in other words the waiting time perceived by the user, and the net and server load, to resolve update requests. If the polling algorithm is not well setted, there is the possibility that a user receives updates late, having the feel that the chat is “slow”, on the other side, there is the possibility that to much not useful update requests overload the server and the net.
The decision about the polling algorithm is made taking in consideration this:
“If there isn't new messages, it's probable that no new messages will come and conversely”
Using this consideration, the time interval between two update requests is adapted at every new request response, increasing if the request response is a “miss”, that means that no new messages are on chat, decreasing if new messages are on chat (“hit”).
There are five parameters to set the algorithm, we will call simply interval the time interval between two subsequent update requests:
Starting interval dimension: this is not an important parameter, it has an effect only in the starting phase of the algorithm;
Interval minimum dimension: the minimum time interval between two subsequent requests;
Interval maximum dimension: the maximum time interval between two subsequent requests;
Interval increasing factor: the time increase that the interval obtain after a miss;
Interval decreasing factor: the time decrease that the interval obtain after an hit.
These parameters influence the algorithm in various modes. For example, setting a very low interval minimum dimension will make really fast the chat from the user perspective. On the other side this will overload the server.
The increasing and decreasing factors are really important parameters, they represent the capacity of the algorithm to follow the changing status of the chat.
After these considerations, we set these parameters as follow (values expressed in seconds):
Starting interval dimension: 3;
Interval minimum dimension: 0,5;
Interval maximum dimension: 5;
Interval increasing factor: 0,5:
Interval decreasing factor: 2.
These settings gives a slow increase to the interval if no messages are on chat, and a fast decreasing if new messages are found. This because if a new message is on chat it is probable that someone will response to that message. The curve that these settings paints is the next (based on a given hit – miss sequence):


nfl jerseys suppliers Fashion
Anonymous (not verified) — Mon, 01/02/2012 - 08:04nfl jerseys suppliers Fashion brand
wholesale coach bags the trend of fashion
coach outlet Don't miss the chance it's very good
coach outlet store comfortable with it
wholesale designer handbags well known great
coach handbags outlet attractive and reasonable price
cheap coach online shopping
coach outlet store may most likely need
coach handbag outlet A good thing
authentic nfl jerseys for sale fashion designed
cheap authentic nfl jerseys together with lifestyle
nfl jerseys
mostnfl (not verified) — Fri, 12/30/2011 - 14:30New England Patriots Jerseys
Authentic New England Patriots Jerseys
Patriots Jerseys Sale
Premier New England Patriots Jerseys
Tom Brady Jersey
Wes Welker Jersey
Chad Ochocinco Jersey
nfl jerseys
mostnfl (not verified) — Thu, 12/29/2011 - 09:40Vernon Davis Jersey ,Joe Greene Jersey Why dont they just Sedrick Ellis Jersey reverse it Jason Pierre Paul Jersey instead Jeremy Maclin Jersey of the blue home and Jason Witten Jersey red away, make Jay Cutler Jersey it red home and blue away, alternate it year-to-year
Post new comment