Apache doesnt appear to be using multiple cores

apache-2.2httpmulti-core

I have a dedicated server with 16gb RAM with a Xeon E5504(8cores @2.0GHZ) running with Centos 7. I ran the top command and can see that 7 of the cores are close to idle most of the time and then one single cores is going flat out. Ive see it go above 100% which i dont understand.

%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 16479600 total,  1233968 free,   616824 used, 14628808 buff/cache
KiB Swap:   523260 total,   499720 free,    23540 used. 15342640 avail Mem

The server is used only as a web host. Apache, MySQL and PHP. I havnt made any changes to apache from its default config. I have heard that the default apache config supports multiple threads, but this clearly isnt the case.

mysqld and httpd are the only things using large amounts of resources. In total apache gets around 100k requests per week. More than enough for this server, but as i continue to add more sites, i dont want to slow it down since everything is on the same CPU.

I read into it an it seems that "prefork" needs to be modified in order to make apache take more resources. I ran the following command to see the default config and it doesnt look like prefork is even installed

/usr/sbin/apachectl -l
Compiled in modules:
  core.c
  mod_so.c
  http_core.c

Im not sure how to test the system to know what the current config is and why only one core is being used. I didnt notice much of a performance increase when moving sites from a low end single core VPS to this server, so im worried something is wrong with the config.

I checked /etc/http/conf/httpd.conf and all thats here are the virtual hosts. There are no lines related to the max clients and other values ive seen people using in the prefork if statement.

Best Answer

Top tells your your system isn't doing anything, as it is 100% idle.

The fields have the following meaning and don't specify specific cores.

       us, user    : time running un-niced user processes
       sy, system  : time running kernel processes
       ni, nice    : time running niced user processes
       wa, IO-wait : time waiting for I/O completion
       hi : time spent servicing hardware interrupts
       si : time spent servicing software interrupts
       st : time stolen from this vm by the hypervisor