Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: lost http request
PostPosted: Thu Jan 10, 2008 11:41 am 
Offline
Senior Member

Joined: Mon May 14, 2007 8:20 am
Posts: 81
I am running the following set up:
polling_client.php
Code:
<?php
echo "<script type=\"text/javascript\" src=\"./prototype.js\"></script>";
echo "<script type=\"text/javascript\" src=\"./polling.js\"></script>";
?>

polling.js
Code:
Event.observe(window, 'load', init, false);
function init()
{
  //setInterval('polling_fcgi();', 1000); 
  setInterval('polling();', 1000); 
}
function polling()
{
  new Ajax.Request
  ( 'polling_server.php',
    { onSuccess: function(transport)
      {
       
      }
    }
  );
}

polling_server.php
Code:
<?php?>

From Firebug, I look at the console to follow the requests.

On my 360 linode (Atlanta data center with Centos 5.0, apache 2.2) the round-trip is around 100-120 ms, with periods where the round-trip takes a couple of seconds.
Once in a while, the request is lost. Firebug displays a red line with a time always around 74000 ms and the "response" tab reads 'loading'
It happens once in a a while that those "lost" requests create a jam that delays all subsequent requests (on my real application, this is the problem).
I ran the same setup on a lunarpages shared webhosting (the basic at $6.95 a month) and the round-trip takes on average 180 ms / 500ms. Slower and wide variations. But, I never get the "lost" requests.

Any idea what the problem might be?
Thanks


Top
   
 Post subject:
PostPosted: Thu Jan 10, 2008 12:55 pm 
Offline
Senior Member
User avatar

Joined: Sun Feb 08, 2004 7:18 pm
Posts: 562
Location: Austin
Packet delivery on the Internet is always "best-effort", never guaranteed. So no application should "jam up" because of a few lost packets.

That said, the Atlanta datacenter seems to have been dropping far too many packets recently. You may be a victim of that.


Top
   
 Post subject:
PostPosted: Thu Jan 10, 2008 8:44 pm 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
Xan wrote:
Packet delivery on the Internet is always "best-effort", never guaranteed.


I thought UDP was best effort only. Is that TCP too?

James


Top
   
 Post subject:
PostPosted: Thu Jan 10, 2008 8:52 pm 
Offline
Senior Member
User avatar

Joined: Sun Feb 08, 2004 7:18 pm
Posts: 562
Location: Austin
You're right; TCP provides guaranteed delivery on top of best-effort IP, by reordering and resending when necessary.

Of course a connection can be dropped if enough packets are lost.

Still, doesn't seem like an application should jam up.


Top
   
 Post subject:
PostPosted: Sat Jan 12, 2008 12:35 pm 
Offline
Senior Newbie

Joined: Sat Oct 01, 2005 12:54 am
Posts: 13
Nah, I think it's an event order issue.

What you SHOULD be doing instead of setInterval is using setTimeout(), and then from onSuccess AND onError, doing setTimeout again. Then, it will always wait for success / error before "restarting the clock".

_________________
--Bdragon


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group