LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache slow, other services fast (https://www.linuxquestions.org/questions/linux-server-73/apache-slow-other-services-fast-852463/)

gcan 12-26-2010 10:44 AM

Apache slow, other services fast
 
Hello,

After server OS (Debian) reinstallation everything was OK and I opened my website to the visitors. After some time I noticed that Apache periodically becames very slow. I can 10-20 clicks and pages load immediately. Then for some 1-2 minutes I can hardly open some page. Then it works fast again. Sometimes 50% of the images on the page load very fast. Then loading freezes for some time, then continues loading again.

Other users report the same problem.

There are no spammers sending spam from this machine or something like that.

When this problem happends, everything runs fast on the server, except Apache. Server load is only ~0.2 - 0.3.

Apache configuration file has default settings and I was running this website with the same scripts and with th same Apache default settings for a long time. Never had problems.

Hostname lookups are disabled.

Any ideas?

PHP Code:

=============================

apache2.conf

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule mpm_prefork_module>
    
StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

<
IfModule mpm_worker_module>
    
StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

===================================

my.cnf

key_buffer              
16M
max_allowed_packet      
16M
thread_stack            
128K
thread_cache_size       
8
query_cache_limit       
1M
query_cache_size        
16M

=============================
cat meminfo

MemTotal
:      3629392 kB
MemFree
:       2907752 kB
Buffers
:         32120 kB
Cached
:         358672 kB
SwapCached
:          0 kB
Active
:         434180 kB
Inactive
:       242340 kB
HighTotal
:     2749072 kB
HighFree
:      2096336 kB
LowTotal
:       880320 kB
LowFree
:        811416 kB
SwapTotal
:     7815544 kB
SwapFree
:      7815544 kB
Dirty
:            3200 kB
Writeback
:           0 kB
AnonPages
:      285700 kB
Mapped
:          13596 kB
Slab
:            22544 kB
SReclaimable
:    12436 kB
SUnreclaim
:      10108 kB
PageTables
:       6608 kB
NFS_Unstable
:        0 kB
Bounce
:              0 kB
WritebackTmp
:        0 kB
CommitLimit
:   9630240 kB
Committed_AS
:   962492 kB
VmallocTotal
:   114680 kB
VmallocUsed
:      6236 kB
VmallocChunk
:   108004 kB
HugePages_Total
:     0
HugePages_Free
:      0
HugePages_Rsvd
:      0
HugePages_Surp
:      0
Hugepagesize
:     4096 kB 


ilvista 12-26-2010 04:23 PM

I've had the same problem in the past.what i did ;i installed ATOP on my server to monitor my cpu and ram utilization.it's a nice tool.

in my case ,the mysqld was causing the problem.and it was overloding the CPU.
so try ATOP to eliminate this possibility.

good luck

gcan 12-27-2010 06:15 AM

I changed Apache configuration file and the problem is gone. New settings:

PHP Code:

<IfModule prefork.c>
StartServers       15
MinSpareServers    10
MaxSpareServers   20
ServerLimit      512
MaxClients       512
MaxRequestsPerChild  0
</IfModule

It's very strange. For years I was using Apache's default settings and never experienced speed problems.


All times are GMT -5. The time now is 01:13 PM.