homepage Welcome to WebmasterWorld Guest from 54.227.63.195
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
too many httpd connections
desiguru




msg:3677336
 7:35 am on Jun 18, 2008 (gmt 0)

My site gets about 20K uniques a day. What's the best way to cut down too many httpd connections and memory usage at any given time?

 

Sharper




msg:3682037
 1:58 am on Jun 24, 2008 (gmt 0)

You didn't specify what web server software you're using, but assuming Apache and 2.X something, look for the MPM section of your httpd.conf. It might be in the main file, or under extra/httpd-mpm.conf.

The various options specify (among other things) how many servers (httpd processes) get run, max connections, etc...

For best results, look at the Apache documentation for your version and review what the numbers mean.

siteperf




msg:3682254
 10:40 am on Jun 24, 2008 (gmt 0)

Timeout 20
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 10
MaxRequestsPerChild 100

MinSpareServers 10
MaxSpareServers 30

for FreeBSD:
AcceptFilter On

the best way it to put some accelerator on front of apache, nginx or lighttpd for example.

wheel




msg:3687155
 8:23 pm on Jun 30, 2008 (gmt 0)

Yup, tweak the settings that siteperf mentions.

In terms of memory useage, your best bet is always just more memory. Nothing beats more memory for an easy fix to speed up a server.

Also, if you're using a database driven site, i.e. a mysql backend, then you'll probably get far better performance increases by tweaking mysql and your website program that calls mysql.

There's two other easy things I'd do on a site that's getting that much traffic. First, make sure apache is compressing or gzipping the output. That'll possibly cut bandwidth by 50% or more. Secondly pore over your HTML and get rid of whitespace. Typical web pages have 30% whitespace - that's a 30% savings on bandwidth and traffic for getting rid of spaces.

desiguru




msg:3700187
 8:23 pm on Jul 16, 2008 (gmt 0)

Here are my settings for a box that as of now has 8GB of ram. Can someone please help me optimize it further. Thank you.

Timeout 300
KeepAlive on
MaxKeepAliveRequests 512
KeepAliveTimeout 10
<IfModule prefork.c>
StartServers 100
MinSpareServers 75
MaxSpareServers 120
ServerLimit 512
MaxClients 512
MaxRequestsPerChild 4000
</IfModule>

<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

---------- my.cnf -----------------

[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

max_connections = 800
key_buffer = 256M
myisam_sort_buffer_size = 64M
join_buffer_size = 2M
read_buffer_size = 2M
sort_buffer_size = 4M
table_cache = 1800
thread_cache_size = 100
wait_timeout = 40
connect_timeout = 20
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 1M
query_cache_size = 128M
query_cache_type = 1
log-slow-queries = /var/run/mysqld/mysql-slow.log
long_query_time = 5

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit = 16384

[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M

estevan




msg:3723898
 4:17 pm on Aug 15, 2008 (gmt 0)

hello

well your content are static or generate by mysql

if are a static content use KeepAlive on else KeepAlive off
update
ServerLimit 812
MaxClients 812

clean apache logs every day 20k generate maybe 1GB all day this use many memory

Best

wheel




msg:3724684
 12:47 am on Aug 17, 2008 (gmt 0)

Most of those numbers seem obscenely high. Timeout of 300? Minspareservers 75?(Keep in mind though, I'm no expert). I have a server with lots of websites on it, at least one (and probably more) that get as much traffic as yours does, and I have 0 problems.

My concern is that you've over tweaked your apache settings. here's what I would do:
- put your apache settings back to the default install (i.e. out of the box). Apache out of the box should have little problem dealing with your load.
- Maybe tweak minspareservers up to 20 or something. Or just a bit higher than the default apache install.
- do some googling on stuff like 'configure mysql' or 'optimze mysql'. Unlike apache which IMO needs little optimizing out of the box, you can get a lot of mileage by tweaking mysql just a bit. I've done a bit of mysql tweaking by doing just as I've noted - reading on google - and seen some excellent results.

in summary, I think you may have screwed up apache. Take apache back to what it is out of the box. Then spend some time tweaking mysql.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved