Project

General

Profile

lighttpd exhaust all the memory

Added by MarkoAmb almost 12 years ago

I have a site mostly with video and photos.
If members start to watch video lighttpd hogs computer until lightty crashes.

I use:

lighttpd -V
lighttpd/1.4.28 (ssl) - a light and fast webserver
Build-Date: Dec 20 2011 14:33:34

Event Handlers:

+ select (generic)
+ poll (Unix)
- rt-signals (Linux 2.4+)
+ epoll (Linux 2.6)
- /dev/poll (Solaris)
- kqueue (FreeBSD)
- libev (generic)

Network handler:

+ sendfile

Features:

+ IPv6 support
+ zlib support
+ bzip2 support
+ crypt support
+ SSL Support
+ PCRE support
+ mySQL support
+ LDAP support
+ memcached support
+ FAM support
+ LUA support
+ xml support
+ SQLite support
+ GDBM support

with fast-cgi

fast-cgi setings:

fastcgi.server += ( ".php" =>
((
"bin-path" => "/usr/bin/php5-cgi",
"socket" => "/tmp/php-fastcgi.socket",
"allow-x-lighttpd-send-file",
"max-procs" => 4,
"min-procs" => 2,
"idle-timeout" => 10,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "5",
"PHP_FCGI_MAX_REQUESTS" => "500"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
))
)

And here some of the what went on just before lighttpd crashed:

from error.log :

2013-01-16 21:47:48: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/php-fastcgi.socket-3
2013-01-16 21:47:48: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 2
2013-01-16 21:49:56: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/php-fastcgi.socket-2
2013-01-16 21:49:56: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 3
2013-01-16 21:55:47: (mod_fastcgi.c.2568) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: unix:/tmp/php-fastcgi.socket-1
2013-01-16 21:55:47: (mod_fastcgi.c.3356) response not received, request sent: 1624 on socket: unix:/tmp/php-fastcgi.socket-1 for /xyxy/xy_script.php?action=get_menu_content&menu_id=22_r=0.46007231293777306, closing connection
2013-01-16 21:55:47: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/php-fastcgi.socket-1
2013-01-16 21:55:47: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 3

And serfer-config:

Server-Features
RegEx Conditionals enabled
Network Engine
fd-Event-Handler linux-sysepoll
Config-File-Settings
Loaded Modules indexfile
access
alias
accesslog
compress
rewrite
redirect
evhost
expire
flv_streaming
evasive
auth
cgi
fastcgi
rrd
status
webdav
dirlisting
staticfile

What should I do, where to look, what can I check to prevent this memory consuption which leeds to very unreliable web site.

Plese help me with advice.

Regards
Mayki


Replies (2)

RE: lighttpd exhaust all the memory - Added by patrickdk almost 12 years ago

Stop using php to send videos to people. Either use mod_secdownload, access them directly, or use x-sendfile.

RE: lighttpd exhaust all the memory - Added by MarkoAmb almost 12 years ago

Hi patrickdk,
thanks for your reply.

Can you please give me some more detailed instruction on how to do that?

If I enable mod_secdownload is there any special directives for this module or it is enough just to enable it?

How about x-sendfile?
Is it enough just to add x-sendfile directive to php-fcgi ot it must be added to the .php scripts as well?

I hope you can help me out.

Kind regards
Mayki

    (1-2/2)