If you have Apache with 100 cpu installed on your machine, hope this user guide can help you.
Right now, there is a problem with our server, which is periodically running Apache processes using 100% CPU.
If we walk, we see the following:
PID USER PR NI VIRT RES SHR S% CPU% MEM-ZEIT COMMAND20788 www-data 20 0318 m 18 m 3984 R 100 0.0 40: 29.21 / usr / sbin / apache2 -k start23523 www-data 20 0319 m 20 m 4684 R 100 0.0 4: 12.36 / usr / sbin / apache2 -k start
I want to try and figure out which script (or whatever) is causing this, so I tried:
strace -p 20788
But it doesn’t show any results (I left it on for about 10 minutes and it doesn’t show anything). As I understand it, this could mean that it is stuck in an infinite loop without having to display “system calls”.
Is there anything else I can do to show what’s going on?
Edit – I forgot to mention that this is a live server with several hundred users at the same time! So I can’t just freely change the configuration parameters and restart Apache.
Edit 2 – the gdb (bt) trace doesn’t seem to be too useful unless PHP is configured with –enable-debug – it just says “execute ()” but I need to know whichThe PHP script is actually being executed. Is there another possibility?
# 0 0x00007f6c143fb0c5 in ?? () from /usr/lib/apache2/modules/libphp5.so# 1 0x00007f6c143b040b in execute () from /usr/lib/apache2/modules/libphp5.so# 2 0x00007f6c1438b970 in zend_execute_scripts () from /usr/lib/apache2/modules/libphp5.so# 3 0x00007f6c14337fe3 in php_execute_script () from /usr/lib/apache2/modules/libphp5.so# 4 0x00007f6c1441ae7d in ?? () from /usr/lib/apache2/modules/libphp5.so# 5 0x00007f6c18912508 in ap_run_handler ()# 6 0x00007f6c1891297e in ap_invoke_handler ()# 7 0x00007f6c18922570 in ap_process_request ()# 8 0x00007f6c1891f398 in ?? ()# 9 0x00007f6c18918fa8 in ap_run_process_connection ()# 10 0x00007f6c189271d0 in ?? ()# 11 0x00007f6c1892793a in ?? ()# 12 0x00007f6c189284e7 in ap_mpm_run ()# 13 0x00007f6c188fd4a4 in main ()
Apache CPU Usage Increases To> = 100%. Why?
This thread has been locked because a year has passed since the last post. Please start a new topic.
This happens quite regularly, but if there is a pattern I’m not sure if I see it (I think it often happens when I first visit the site after a while, but I’m not sure).
Even if only one person tries to access the site, it will freeze for a minute orve and then becomes completely normal. I’ve set up a script that runs iostat and vmstat whenever it detects that the load average is greater than 1 and there doesn’t seem to be any swap. This, and the fact that performance did not stop completely, leads me to conclude that this is more of a software issue than a hardware issue.
I’ve included custom modules, but this is an example of a custom authentication module that would be difficult to disable. So what I really need is that Moodle can profile and tell which modules are doing the hard work. Does this exist? Do you have any other tips on how to deal with this?
It might be interesting to note that I’m using an older version (2.2) on a shared VM (although I don’t think another VM can dramatically increase the CPU usage on mine?), and that I’m in the process of upgrading and moving to a dedicated the virtual machine will take a while and I would really like to know what’s going on here.
– Moodle is a heavy application. It is possible that one user can override the share
. Of course, you can only be sure of this if you publish the specifications for your shared server.
– Depending on the structure of the shared system, your VMSTAT may display the load on another shared server. But when you see he is still alone
, this should be your Moodle. Can you reproduce this peak by repeating a few steps in your Moodle?
– Does it make a difference if the user is “admin” or a regular user?
– What type of caching, in particular PHP caching, is active? Can you reproduce the charge by clearing the cache?
Not all virtual machines are created equal. SomeTheir performance is poor, especially in terms of hard disk I / O speed.
Is the performance significantly worse when logged in as an administrator than, for example, a course participant? In this case, you might suspect that you are having caching issues because Moodle is trying to cache on a slow hard drive.
Anyway, you need to tell a little more about the resources that you have provided Moodle in your virtual machine.
Thanks for the answers!
I think the most interesting / promising point here is about admin accounts that affect performance. My account is set up as a site administrator, thinking “why not” at the time? Maybe I’ll find out now. Can anyone comment on how admin rights can cause this issue? If I remove the Administrator role site from my main account, but keep full permissions for myself, should this work if that’s the reason?
If so, are there any best practices in this regard? For example, are you just doing something that requires admin rights outside of business hours?
In case this is something else, I will do my best to provide the rest of the information you requested.
Unfortunately, I don’t know which hypervisor is used for the VM, but I can ask.
/ proc / cpuinfo displays two 3.4 GHz Xeon processors
free shows 2053/5984 MB of free RAM and 3071/3071 MB without swap.
Viswanath, you asked, “What kind of caching, especially PHP caching, is active?” Is it possible to reproduce the load by clearing one or more caches? ”
To be honest, I don’t know which PHP cache is active. What should I watch out for? If it helps:
$ grep ‘^ [^;]. * cache ‘/etc/php5/apache2/php.ini
pdo_mysql.cache_size = 2000
mysql.cache_size = 2000
mysqli.cache_size = 2000
session.cache_limiter = nocache
session.cache_expire = 180
soap.wsdl_cache_enabled = 1
soap.wsdl_cache_dir = “/ tmp”
soap.wsdl_cache_ttl = 86400
soap.wsdl_cache_limit = 5 p>
One of the reasons I am working on an update is because I read that Opcache will help with newer versions, but work on that is still ongoing.
When you say “clear cache” do you mean the “clear all caches” link in Moodle? If so, then I did it and it doesn’t cause the severe slowdown I’m talking about.
Asking for an administrator account was just a symptom to be considered, not a suggestion for a solution. The administrator account (and any other site-based role) must create the site administration menu structure on every page load. If all of these settings pages and associated resources are loading much slower than a “normal” account, this can be a useful indicator.
You can go to the Site Administration> Plugins