Question

A couple of days ago I noticed a strange thing - from time to time server stops processing request for some time. At the top output it looks like this:

  • ten Unicorn workers process requests;
  • then, for some reason, they stop doing anything. I mean, all ten workers have 'sleeping' status;
  • for a ten-fifteen seconds they sleep;
  • and then suddenly all then workers at the same time start processing requests (lots of them were queued for 10s);

I have the following setup: nginx, unicorn 4.6.2, postgres, redis for sessions and cache, MRI ruby 2.0.0p353.

My first thought was to blame redid (because if redis doesn't give sessions, all process will wait for it), but it seems it is not the case, because while unicorn workers freeze, redis serving other processes that do background jobs.

I don't understand what is the reason of this strange behaviour.

If someone have some thoughts on the matter I would gladly check it. If you need additional information - just tell me what to do, and I'll try to provide it.

UPDATE:

Was it helpful?

Solution

It turned out (with the help of strace on worker processes) workers were trying to write logs on the disk. Disk was heavy loaded and processes were blocked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top