nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Lighttpd eating more RAM than Apache.

This is a discussion on Lighttpd eating more RAM than Apache. within the Web servers forums, part of the Mastering Servers category; I am in mid phase of replacing apache with lighttpd , I have 600 MB RAM , when apache runs ...


Go Back   nixCraft Linux Forum > Mastering Servers > Web servers

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 06-25-2008, 04:53 PM
Junior Member
User
 
Join Date: Jun 2008
My distro: centos 5
Posts: 15
Rep Power: 0
rootadmin is on a distinguished road
Arrow Lighttpd eating more RAM than Apache.

I am in mid phase of replacing apache with lighttpd , I have 600 MB RAM , when apache runs alone it eats 200 MB RAM where as lighttpd eats 550 MB RAM in same conditions
.Site functions faster with lighttpd but during peak hours lighttpd crashes since it goes short of RAM .

below is my main settings of lighttpd , plz tell what changes should i make

PHP Code:
fastcgi.server             = ( ".php" =>
                              ( 
"localhost" =>
                                (
                                   
"socket" => "/tmp/php-fastcgi.socket",
                                   
"bin-path" => "/usr/bin/php-cgi",
             
"min-procs" => 22,
     
"max-procs" => 5,
     
"max-load-per-proc" => 4,

"idle-timeout" => 20



 
)
                               )
                            ) 
Thanks In Advance.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-25-2008, 05:40 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 564
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

I don't wanna believe you. Are you sure about memory issue? Do you run lighttpd in VPS server or dedicated server? How many PHP requests per second do you need? If you need 25 PHP requests per/sec, then
25 * 0.1sec/php = 2.5 php process. Let us round it to 3 process. Here is some optimized config:
Code:
fastcgi.server    = ( ".php" =>
        ((
                "bin-path" => "/usr/bin/php-cgi",
                "socket" => "/tmp/php-cgi.socket",
                "max-procs" => 3,
                "idle-timeout" => 30,
                "bin-environment" => (
                        "PHP_FCGI_CHILDREN" => "50",
                        "PHP_FCGI_MAX_REQUESTS" => "500"
                ),
                "bin-copy-environment" => (
                        "PATH", "SHELL", "USER"
                ),
                "broken-scriptfilename" => "enable"
        ))
)
Once updated you need to install xcache
Redhat / CentOS / Fedora Linux Install XCache for PHP 5
XCache - Boost PHP Performance - Trac

You also need to optimize mysql by enabling mysql query cache
MySQL :: MySQL 5.0 Reference Manual :: 7.5.4 The MySQL Query Cache
Enable the query cache in MySQL to improve performance

Also note that sometime VPS put restrictions on open file and connections.
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #3 (permalink)  
Old 06-25-2008, 09:40 PM
Junior Member
User
 
Join Date: Jun 2008
My distro: centos 5
Posts: 15
Rep Power: 0
rootadmin is on a distinguished road
Default

I used your settings but lighttpd eated all the RAM , as more than 30 instance of php-cgi were started as soon lighttpd was started .
and i got two big sites
alexa ranking of one is 5K ----------its file/ image sharing (thubnails enabled)
the other is an IPB forum alexa ranking 15K
I hv no idea how much php request i get , hope you hav estimated it with abv information also i am already using xcache .I think mysql is tuned since it takes only 10% of RAM.
Reply With Quote
  #4 (permalink)  
Old 06-26-2008, 08:55 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 919
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

You need to tell us about request per seconds you get (turn on mod_status in lighttpd set fast fastcgi.debug = 1 and monitor error log file to get exact load of php. How did you find out that lighttpd is eating all memory? What is output of the following?
Code:
ps aux | grep php
w
atop
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #5 (permalink)  
Old 07-04-2008, 08:35 PM
Junior Member
User
 
Join Date: Jun 2008
My distro: centos 5
Posts: 15
Rep Power: 0
rootadmin is on a distinguished road
Default

well i dnt got fastcgi.debug anywhere in my lighttpd.conf ,
using monit n top cmmand i come to conclusion lighttpd eating ram ,

fastcgi.active-requests: 2
fastcgi.backend.0.0.connected: 55701
fastcgi.backend.0.0.died: 0
fastcgi.backend.0.0.disabled: 0
fastcgi.backend.0.0.load: 2
fastcgi.backend.0.0.overloaded: 0
fastcgi.backend.0.load: 3
fastcgi.requests: 55701
Reply With Quote
Reply

Bookmarks

Tags
fastcgi , lighttpd


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
lighttpd ProxyPass thunderbirdsei Web servers 0 04-30-2008 10:50 PM
Can lighttpd access log be filtered? petu Web servers 2 01-18-2008 10:59 AM
Apache and lighttpd together anjanesh Web servers 4 08-29-2007 05:11 PM
redirect to www in lighttpd muks Web servers 11 06-02-2007 10:55 PM
lighttpd user cgi-bin setup chiku All about FreeBSD/OpenBSD/NetBSD 1 12-15-2006 01:52 AM


All times are GMT +5.5. The time now is 11:12 PM.


Powered by vBulletin® Version 3.7.3 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36