Top & httpd - demystifying what actually works

I often use the "top" command to see what happens to resources. This is basically a long list of Apache httpd processes, which is not very useful. Is there a way to see a similar list, but so that I can see which PHP scripts, etc. Are these httpd processes actually running?

+4
source share
4 answers

If you are worried about lengthy processes (i.e. requests that take more than a second or two to complete), you can get an idea of ​​how to use them with Apache mod_status. See the documentation and sample output (from www.apache.org). This is not unique to PHP, but applies to everything that runs inside the apache process.

Please note that the status output www.apache.org is available publicly for demonstration purposes - you want to restrict access to yourself so that not everyone can see it.

+4
source

There is a ncurses-based utility called apachetop that provides real-time log analysis for Apache. Unfortunately, the project was abandoned and the code suffers from some errors, however it is really very useful. Just don't run it as root, run it like any user with access to the web server log files, and you should be fine.

+1
source

Php scripts are so fast that the top will not show you very much. Or that would be pretty fast. Most web requests are pretty fast.

I think it would be best to have some type of real-time log handler that kept track of your access logs and updates for you average runtime, memory usage and the like.

0
source

You can make your PHP pages yourself and write your path and runtime for a file or database. Please note that this will slow down during monitoring, but it will be a good measurement method.

That would not be so interactive. You can get daily or weekly results from it, but it would be difficult to see something meaningful in a few minutes or hours.

0
source

Source: https://habr.com/ru/post/1277278/


All Articles