1

the website has a few heavy pages, in these pages I'm loading statistical graphs which requires some heavy and slow MySQL queries.

While the heavy page is loading and the browser is waiting for the response every other page (for example contact page) is stuck on loading too. And immediately after the heavy page returns a response all other pages loads.

It's important to note that the slowing is only for the requesting client, while the heavy page is loading other clients can open the contact page or any other page right away.

The website runs on Apache with prefork and Nginx for the static files and flexibility. MySQL tables are on InnoDB storage engine.

It seems that there is some kind of limit for max requests per client or something like that, but I don't know where to look. I don't think it's a PHP config, because I've tried setup one PHP page with sleep(10); and while the page is loading, no other pages are slowed down. Maybe it's some MySQL config..?

nacholibre
  • 3,874
  • 3
  • 32
  • 35

1 Answers1

1

I found my problem, it is PHP session locking. If a request using session_start() is not finished, another request using session is waiting and after the first one finished, the second one can start running. More info here https://ma.ttias.be/php-session-locking-prevent-sessions-blocking-in-requests/

nacholibre
  • 3,874
  • 3
  • 32
  • 35