0

I would like any hints or ideas as to what might be causing the following situation.

The website is on a Debian server with nginx 1.6.2, php5 through fpm.

A GET request to a page is supposed to generate a ZIP archive of considerable size from a few requested files that are on the server. It's a resource demanding operation, taking about 30 seconds (let's say) and consuming ~500+MiB of memory.

Now if during that operation the client attempts to open another page, the PHP's session handling will impose a delay for that page to open until the first GET request is finished. All this is within my understanding up until now.

However: if the client (insistently) refreshes the browser several times (5-8) the server will not respond at all to ANY user, not just the insistent one. This bugs me because the nginx configuration is set to 2 worker_processes, each with 1024 worker_connections, which should give me at least about 1000 connections before the server goes bunkers.

Top command reveals little CPU load.

Enlighten, please.

4
  • 1
    have you set "pm_max_children" in the php pool.d config? – Orphans Dec 23 '16 at 7:27
  • "WARNING: [pool www] server reached pm.max_children setting (5), consider raising it" looks like we're on the right track @Orphans – Slavic Dec 23 '16 at 11:29
  • Looks for pm.max_children in /etc/php5/pool.d/www.conf and change it to a higher value – Orphans Dec 23 '16 at 12:22
  • 1
    Yes, already addressed this. Please make this into a response - I'll select it. – Slavic Dec 23 '16 at 12:46
1

Looks like PHP is running out of children. In your case - try edit:

/etc/php5/fpm/pool.d/www.conf

Look for pm.max_children = 5 and change it to a higher value (10 or more)

You could also check for php_admin_value[memory_limit] = 32M (max allow memoryconsumption allow for each child)

Remove the comment and change the value to something that suites you setup.

0

<Stuck record>

You need to be scientific and methodical in your approach to this. In particular Scientific Method is your friend.

  • Install monitoring
  • Gather data
  • Analyse data
  • Make changes based on analysis
  • Monitor changes
  • Document

Rinse and repeat as necessary

</Stuck record>

-1

My best guess is the CPU is exhausted. Have you used "top" to work it out?

Nginx lets you impose rate limits with the rate limit module. There's a tutorial on how to do this here, but it's more at the resource level than the IP level, I think. This block should limit requests and connections, which would be more appropriate for you - code from this site.

http {
  ...
  limit_conn_zone $binary_remote_addr zone=alpha:8m;
  limit_req_zone  $binary_remote_addr zone=delta:8m rate=30r/s;
  ...

  server {
    ...
    limit_conn alpha 5;
    limit_req  zone=delta burst=80 nodelay;
    ...
  }
}
1
  • I forgot to add that CPU stands quietly under 40%. Also from my experience it's never the CPU - something else gives up first. I'll add the top output to my question. – Slavic Dec 22 '16 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.