ajax really slow in production, very weird

It works fine when I start a single instance of mongrel or thin. But when I use thin cluster or passenger, some ajax is really slow, takes about 2 minutes to complete. Any sugestion? By the way, I tried passenger for nginx and nginx + thin cluster.

What does your production log say? How many ms does it take to render your request?

It looks that the request has problems reach a thin instance, as soon as it reaches the thin instance, the request completes quickly. The production log says it took about 150000ms to complete the request. But not all the request has the problem, some of them complete within half a second which is normal. I'm guessing that nginx has problems dispatching the request to a thin or passenger instance. Has any body encountered this problem before?

It looks that the request has problems reach a thin instance, as soon

as it reaches the thin instance, the request completes quickly. The

production log says it took about 150000ms to complete the request.

But not all the request has the problem, some of them complete within

half a second which is normal. I’m guessing that nginx has problems

dispatching the request to a thin or passenger instance. Has any body

encountered this problem before?

Is this a local or remote deployment? In any case, I would do the

following:

  1. check your connection to the internet

  2. check with your New Relic or other performance monitoring to track the

issue

  1. re-check the overall configuration of the system

  2. reboot nginx and thin servers and see if the problem still persists

  3. check with the hosting company

  4. do testing in production mode on you local system using the same remote

configuration to see if the issue exists

Good luck,

-Conrad

first, I'm sure my connection to the internet is ok. And the problem exist after i restart nginx and thin, and it is repeatable. I did tested on my local machine with the same configuration, it works fine. I used ubuntu 8.10 on my local machine, but the server runs on freebsd 7.2, so maybe there's some difference.

first, I’m sure my connection to the internet is ok.

You’re sure but did you check it.

And the problem exist after i restart nginx and thin, and it is

repeatable. I did tested on my local machine with the same configuration, it works

fine. I used ubuntu 8.10 on my local machine, but the server runs on freebsd

7.2, so maybe there’s some difference.

It’s not really the same configuration if you’re using binaries built for Linux

locally and FreeBSD binaries remotely. In theory, they would be the same

but in practice they may not be. Did you check with your hosting company?

What do the logs say for both nginx and thin? What’s the performance like

without Javascript enabled?

-Conrad

I got the problem solved!

It turned out to be a directory access problem. I used texlive for math formular editing, and the access mod for directory that contains these executables is 777. After I changed it to 755, the problem disapeared. I overlooked a warning in my log, which says: 'world writable directory /xxx/xxx'. And I didn't expect this would cause such weird behavior, I don't see much connection here..

I wasted a lot of time on this and it really taught me a lesson!

Thanks for all your kind help. You are a very nice man!