开发者

when long polling, Why are my other requests taking so long?

The client makes 2 concurrent requests. (1 which takes 60 seconds - long polling) and another which is NOT long polling - supposed to return right away. It does return right away when I'm not doing long polling. But as soon as I start doing long polling with the other thread, the other one takes forever to execute.

Firebug shows that the request is waiting for 10-50 seconds. On the server, I profiled ALL requests from the moment the php script starts to the time it goes back to the client, and it shows that each one only took 300ms or less.

This problem started about the same time I started doing long polling (with the other XHR 开发者_JAVA百科requests). I'm using jquery for both requests.

The server shows that it is under very light load. CPU and memory less then 2%. 8 processes running out of a pool of 15. (it doesn't seem to deviate much from that number 8, even when I run more ajax requests). I guess each process can run multiple ajax threads concurrently.

I made sure to EXIT from all processes as soon as their done executing. I don't see how the process pool has run out, if there are still 7 unused processes listed under prstat -J. Also, the problem happens somewhat intermittently. Firefox should be able to handle 2 concurrent ajax requests. i dont get what the problem is.


I had the same problem with firefox and two jsonp requests, one long polling. The problem is that jsonp is basically just script tags that fetch javascript and firefox loads dynamically inserted scripts synchronously.

That's why the long polling request has to finish before the second one even starts loading.

If your case isn't jsonp I can't offer any help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜