Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1632
  • Last Modified:

Apache with slow response after minutes

Hello!

I´m running a server with Linux Fedora Core 2 + Directadmin (Apache 1.3.41, Mysql 4, Php 4, Exim+VMpop3).
I´m trying to tunning the configuration of HTTPD due to problems with the speed of my served pages. It seems work fine, but after minutes/hours, it takes ages in serve a simple html page (10-20 seconds).

Kernel:
2.6.5-1.358smp #1 SMP Sat May 8 09:25:36 EDT 2004 i686 i686 i386 GNU/Linux

HTTPD.CONF
Timeout 15
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 3
MinSpareServers 10
MaxSpareServers 15
StartServers 5
MaxClients 80
MaxRequestsPerChild 1000

Loaded modules:
Compiled-in modules:
  http_core.c
  mod_so.c
  mod_frontpage.c
suexec: enabled; valid wrapper /usr/sbin/suexec

PHP:
PHP 4.4.9 (cli) (built: Nov 11 2008 19:59:32)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
    with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.2.8, Copyright (c) 1998-2007, by Zend Technologies

Resources usage:

  1  [#**                                                 4.6%]     Tasks: 156 total, 1 running
  2  [#****                                               7.9%]     Load average: 0.17 0.13 0.17
  Mem[|||||||||||||||||||||||###*********************378/947MB]     Uptime: 1 day, 08:23:19
  Swp[                                                0/1913MB]

HTTPD process:


  PID USER     PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command                                                              
31163 root      16   0  3080  1072  1776 R  1.3  0.1  0:00.12 htop                                                                  
28855 apache    16   0 48244 36932 24680 S  0.7  2.4  0:00.58 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
28874 apache    15   0 48252 37088 24480 S  0.7  2.4  0:01.01 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
28875 apache    15   0 48220 37072 24480 S  0.7  2.4  0:01.04 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
29135 apache    15   0 48912 37892 24684 S  0.7  2.4  0:02.58 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
 2423 mysql      6 -10  179M 62096 3756 S  0.0  4.0  3:48.51 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --p
28870 apache    16   0 47924 37108 24480 S  0.0  2.4  0:00.56 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
29127 apache    16   0 48196 37180 24480 S  0.0  2.4  0:01.07 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
29128 apache    15   0 48160 36820 24680 S  0.0  2.4  0:00.45 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
31164 root      16   0  1708   596  1388 S  0.0  0.0  0:00.00 vm-pop3d -d 10 -t 600
 2092 named     16   0 48908  4200  4796 S  0.0  0.3  0:06.71 /usr/sbin/named -u named
28876 apache    16   0 48224 37068 24480 S  0.0  2.4  0:00.87 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
28882 apache    17   0 48384 37080 24680 S  0.0  2.4  0:01.39 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
29119 apache    16   0 48204 37004 24680 S  0.0  2.4  0:01.03 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA
29126 apache    15   0 48176 37024 24480 S  0.0  2.4  0:00.45 /usr/sbin/httpd -DHAVE_AUTH -DHAVE_LOG_AGENT -DHAVE_DIR -DHAVE_MIME_MA

ps aux |grep httpd |wc -l
82

Connections:

# netstat -an |grep :80 |wc -l
515
# netstat -an |grep :80 |grep ESTABLISHED |wc -l
163
# netstat -an |grep :80 |grep TIME_WAIT |wc -l
281

Please, i appreciate any suggest about of it.

Thanks in advance

Regards
0
admin112
Asked:
admin112
  • 3
1 Solution
 
dainokCommented:
Enable Apache server-status (http://httpd.apache.org/docs/2.0/mod/mod_status.html):

LoadModule status_module modules/mod_status.so

<Location /server-status>
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from .foo.com
</Location>

Go to http://yourServer/server-status?auto and check if you have enough IdleWorkers available.
Adjust worker as needed and restart Apache::

StartServers 20
MinSpareServers 10
MaxSpareServers 100
MaxClients 2000
MaxRequestsPerChild 20000
0
 
admin112Author Commented:
Thank you, let me try it.

By the way, i have disabled keepalive putting keepalive off and it is fast as light. I heard bad things about of disable it (could slow things). But with an oldest P4 could be good low the cpu cycle.

What you think of it?

Thanks
0
 
admin112Author Commented:
Thank you very much.
0
 
admin112Author Commented:
In my case, that optimization could be excessive due to my low resources server (P4). However, use of mod_status was very useful, detected problems with idle servers and busy servers, and the most important thing:

An client was doing an include to php file opening a connection to the http, instead of open file...
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now