views:

64

answers:

1

I have a web site in closed beta, developed in Django, runs with Mysql on Debian.

In the last few days, the main page has been showing a slowdown. For every ten clicks, one or two receives extremely slow response (10 secs or more), others are as fast as they used to be.

When I was searching for the problem, I ran into this issue that I couldn't grasp:

top command shows that when I request the main page, mysql shoots up to 90% - 100% cpu usage. I get the page just as the cpu use gets back to normal. So, I thought, it is db.

Then I called ab with parameters -n 1000 -c 5, I got decent performance, about 100 pages per second, just as it was before the slowdown. I would imagine a worse performance as 10-20% of requests take 10 secs to load.

Is this conflict between ab and "real" clicks normal, or am I using ab in a wrong configuration?

A: 

ab doesn't execute many parts of the page (javascript i.e.) so you'll notice probably a sensible difference in pressure to the webserver.

Ass3mbler
Thanks for the answer. However, the slowdown does not stem from the loading or executing javascript (js files are compressed, versioned and have far-future expiration days).
shanyu
But does the javascript do some other call to the webserver (i.e. ajax) when executed on the client side?
Ass3mbler
No, there's no ajax on the page I am benchmarking. It may be worth to mention that the browser freezes while waiting for the server (for about 10 secs), and then gets and renders the page very fast.
shanyu
ok... so the problem must be on other page element not handled by ab, like session data. Do you store your session on mysql?
Ass3mbler