2

As you can see below, a single Apache process hangs and takes large amount of CPU resources. How can I find what http call this apache process runs?

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
12554 www-data  20   0  776m 285m 199m R   97  3.7  67:15.84 apache2
14580 www-data  20   0  748m 372m 314m S    4  4.8   0:13.60 apache2
12561 www-data  20   0  784m 416m 322m S    3  5.4   0:58.10 apache2
12592 www-data  20   0  785m 427m 332m S    2  5.6   0:57.06 apache2
1

1 Answer 1

3

Use strace with the specific PID. Given your example the syntax would be sudo strace -p 12554. You can also use the -o option to output to a file since it may be too fast to follow on screen.

The following guides/tutorials may help, since strace use and output may not be intuitive for the uninitiated:

1
  • I used strace and this is what I see in endless loop: poll([{fd=41, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) clock_gettime(CLOCK_MONOTONIC, {191119, 521541040}) = 0 clock_gettime(CLOCK_MONOTONIC, {191119, 521579361}) = 0 clock_gettime(CLOCK_MONOTONIC, {191119, 521619004}) = 0 gettimeofday({1349194313, 932472}, NULL) = 0 gettimeofday({1349194313, 932517}, NULL) = 0 poll([{fd=41, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) Any idea what I can learn from this?
    – Nir
    Oct 2, 2012 at 16:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .