Solved

Web site is slow running over Lighttpd

Posted on 2008-09-30
2
1,142 Views
Last Modified: 2013-12-06
Hello!

I´m running a website (www.goear.com) with Lighttpd 1.4.19 in a Dell Poweredge 2950, Quad core E5410, 8 GB RAM DDR2, 2X146 GB SAS 15.000 RPM for the system and a RAID 6 with 6x1 TB SATAII for the storage, in a Centos 5.2 X64_86 (Kernel vanilla 2.6.26.x). This site mainly offer to the user  play mp3 files with a flash player (swf). Actually, our web site is coded over PHP (very basical web site, really) with a average of 3000-4000 connections actives simultaneously. Our web server is only used for storage MP3 files and for serve PHP pages and MP3 files, mysql server is running in an another box.
Unfortunately, sometimes, site load very slow... 7-8 seconds for load a basic page, but the server isnt under a heavy load. I understand about of the bad programming of the web site, but in fact, i think there is a bottleneck (not only an issue of bad programming).

I appreciate any idea.

Thanks in advance

LIGHTTPD.CONF:
server.document-root        = "/var/www/goear/"
server.max-connections = 6144
server.max-fds = 18432
server.max-worker = 4
server.max-request-size        = 30000
server.max-write-idle = 3600
server.max-read-idle = 10
server.max-keep-alive-requests = 0
server.max-keep-alive-idle = 0
server.use-noatime = "enable"
server.event-handler = "linux-sysepoll"
server.network-backend = "linux-sendfile"
# ENABLED MODULES
 "mod_redirect",
"mod_access",
 "mod_fastcgi",
"mod_accesslog" )

HTOP OUTPUT:
  1  [*                                                   0.7%]     Tasks: 76 total, 1 running
  2  [#****                                               6.6%]     Load average: 3.24 2.69 2.66
  3  [#*                                                  1.3%]     Uptime: 4 days, 05:03:25
  4  [#*                                                  2.0%]
  Mem[|||#******************************************308/8004MB]
  Swp[|||||||                                       115/1027MB]

FREE OUTPUT:
             total       used       free     shared    buffers     cached
Mem:          8004       7960         43          0         83       7568
-/+ buffers/cache:        308       7695
Swap:         1027        115        912
Total:        9031       8075        956

DSTAT OUTPUT SDA (SYSTEM DISK):
----total-cpu-usage---- ------memory-usage----- ---system-- --net/eth0- --net/eth1- --dsk/sda-- interrupt
usr sys idl wai hiq siq| used  buff  cach  free| int   csw | recv  send: recv  send| read  writ|
  1   1  78  20   0   1| 312M   84M 7566M   42M|6075  1308 |   0     0 :   0     0 | 137k  232k|
  1   1  61  35   0   1| 313M   84M 7566M   42M|8963  1895 | 823k   19M: 681k   68k|1365B 9557B|
  0   1  72  24   0   2| 313M   84M 7565M   42M|8696  1994 | 721k   17M: 535k   59k|  13k  853k|
  1   1  57  40   0   2| 314M   84M 7562M   44M|8747  1571 | 793k   18M: 392k   46k|  19k   16k|

DSTAT OUTPUT SDB (RAID 6 WITH MP3 FILES):

----total-cpu-usage---- ------memory-usage----- ---system-- --net/eth0- --net/eth1- --dsk/sdb-- interrupt
usr sys idl wai hiq siq| used  buff  cach  free| int   csw | recv  send: recv  send| read  writ|
  1   1  78  20   0   1| 313M   83M 7566M   42M|6075  1308 |   0     0 :   0     0 |8295k  168k|
  1   1  49  48   0   1| 314M   83M 7564M   43M|8605  1696 | 800k   19M: 609k   64k|  16M  441k|
  1   1  58  38   0   2| 313M   83M 7567M   41M|9158  2132 | 789k   17M: 852k   78k|  14M  304k|
  1   1  73  23   0   2| 313M   83M 7567M   42M|8972  1871 | 794k   18M: 634k   64k|  13M  169k|

Kernel:
Linux web.goear.com 2.6.26.5 #1 SMP Wed Sep 24 21:59:18 CEST 2008 x86_64 x86_64 x86_64 GNU/Linux

SYSCTL CHANGES:
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_tw_recycle = 1

net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2


# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

# time-wait assasination
net/ipv4/tcp_rfc1337=1
# reduce keepalive
net.ipv4.tcp_keepalive_time=300
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
#net.core.wmem_max = 1048576
#net.ipv4.tcp_wmem = 4096 87380 524288

#net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216


NET:

100425 packets sampled in 5 seconds
Traffic average for eth0

      rx         594.09 kB/s           7367 packets/s
      tx       18095.71 kB/s          12718 packets/s

I appreciate any ideas.

Thanks in advance
0
Comment
Question by:admin112
2 Comments
 
LVL 23

Accepted Solution

by:
Mysidia earned 500 total points
Comment Utility
server.max-worker = 4
You expect  4 worker threads to handle 3000 simultaneous connections?


Try at least
server.max-worker = 10

For >3000 connections,  I would be inclined to use 50  child processes
for maximize parallelism in handling requests.

0
 

Author Closing Comment

by:admin112
Comment Utility
thank you very much. It was pretty useful for me.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now