switching from Apache to Lighttpd

switching from Apache to Lighttpd

Posted by: dfj225
Posted on: 2009-03-15 13:50:00

I just noticed a new configuration option to switch from Apache to Lighttpd on my PS.

Has anyone had any luck with this?

I'm wondering, if I make the switch and things are broken if switching back to Apache will fix everything. Has anyone tried this?

For reference, I'm running WordPress, PhpBB, and Media Wiki on my PS.

Thanks!

Re: switching from Apache to Lighttpd

Posted by: pangea33
Posted on: 2009-03-15 19:24:00

I am really pleased with Apache for the most part, and it's a plus that I am familiar with it. So far I haven't seen a compelling reason to switch to another web server. What features do you see that seem to make the switch worthwhile?

Re: switching from Apache to Lighttpd

Posted by: dfj225
Posted on: 2009-03-15 19:37:00

Mostly a lower memory footprint. If I understand things correctly, Lighttpd will handle multiple requests using threads instead of spawning multiple processes like the Apache instances on my PS are set to do.

Other than this, there probably isn't much reason to switch.

Re: switching from Apache to Lighttpd

Posted by: pangea33
Posted on: 2009-03-15 20:31:00

From the little bit I have come to learn, it looks to me like lighttpd uses standard cgi functionality via multiple script instances by default, just like Apache. Running everything through one application instance, which will provide the smaller memory footprint and increased performance, is implemented by using fastcgi just as with Apache. It appears that using fastcgi also requires you to pay special attention to some parts of your code in order to support it.

I am not trying to say it isn't worthwhile to try something new, I am just trying to point out that I think you've got to jump through the same hoops with Lighttpd as with Apache. If you can run both webservers on one machine it might be a useful endeavor, but I personally wouldn't want to make a wholesale switch based on my limited knowledge.

From: http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModFastCGI

In reply to:

lighttpd provides an interface to external programs that support the FastCGI interface. The FastCGI Interface is defined by http://www.fastcgi.com/ and is a platform-independent and server-independent interface between a web-application and a webserver.

This means that FastCGI programs that run with the Apache webserver will run seamlessly with lighttpd and vice versa.

...

FastCGI removes a lot of the limitations of CGI programs. CGI programs have the problem that they have to be restarted by the webserver for every request which leads to really bad performance values.

FastCGI removes this limitation by keeping the process running and handling the requests by this always running process. This removes the time used for the fork() and the overall startup and cleanup time which is necessary to create and destroy a process.



http://wiki.dreamhost.com/Fastcgi#Changes_to_make_to_your_scripts

Re: switching from Apache to Lighttpd

Posted by: sXi
Posted on: 2009-03-15 20:38:00

Ask Support if Lighty will bind to port 80 using the Panel switch.




How To Install PHP.INI / ionCube on DreamHost

Re: switching from Apache to Lighttpd

Posted by: dfj225
Posted on: 2009-03-15 20:48:00

Yes, I think you are right that trying to move all my live apps from Apache to Lighttpd on the fly would not go so well.

Right now its not obvious, but it seems that it might be possible to have Lighttpd running on my PS along with Apache.

If its possible to run both at the same time, I'll test each application on Lighttpd and only switch the live site over if everything checks out.

Re: switching from Apache to Lighttpd

Posted by: sXi
Posted on: 2009-03-15 22:17:00

In reply to:

...trying to move all my live apps from Apache to Lighttpd on the fly would not go so well.


There's absolutely no reason it wouldn't go well.

In reply to:

I'm running WordPress, PhpBB, and Media Wiki on my PS.


None of those are reliant on fcgi perl scripts that would require modification.

In reply to:

If its possible to run both at the same time...


It is. But you can't bind both Apache and Lighty to port 80 simultaneously.

The only thing that would possibly change with your setup is that if Lighty doesn't bind to port 80 then your user's will see something like domain.com:81/index.php in their address bar. If DreamHost have the webserver switch setup so that Apache completely disappears and Lighty binds to port 80 then the change should be positively seemless. You can either ask them if that's the case or just hit the switch and see for yourself.

You can always switch back wink




How To Install PHP.INI / ionCube on DreamHost

Re: switching from Apache to Lighttpd

Posted by: dfj225
Posted on: 2009-03-15 22:33:00

I hit the switch :-)

What happens is that Lighttpd does bind to port 80 and all Apache instances shut down.

The apps seemed to work fine :-)

The only problem (and I anticipated this) is that the one subversion repo that I also have on my domain was no longer accessible. Hopefully, I won't need subversion access for much longer, but until then it looks like I'm stuck w/ Apache.

Also, the amount of memory used on the system did seem lower (of course this is really unfair as I was only running Lighty for a few minutes), but the biggest difference seems that there is only one Lighty process compared to about ~8 Apache processes for the same load.



Re: switching from Apache to Lighttpd

Posted by: sXi
Posted on: 2009-03-16 03:37:00

Thanks for the report! This info is great news and will help alot of people deciding whether to switch over or not. Actually it'll probably lead to many PS users switching over to Lighty rather than sticking with Apache from fear of the dark. It will definitely speed up many sites - which as we all know equates to happier enduser experience - and maybe even save the PS webmasters some ca$h by allowing them to drag that memory slider back a chunk with no ill effect.

The benefits will be more apparent as more users connect to your server simultaneously. Many benchmarks suggest Lighty's up to twice as fast.

Please keep us informed of your progress after you've played around with it a bit! smile




How To Install PHP.INI / ionCube on DreamHost

Re: switching from Apache to Lighttpd

Posted by: tscheisskopf
Posted on: 2009-03-16 19:11:00

Here's a little intel on Joomla and Lighty from ircmaxell, one of the smarter Joomla guys around and now head of the Joomla Security Team:

http://www.ircmaxell.com/articles/hosting/lighttpd-and-joomla---a-how-to.html

Ahem...anyone from Oz want to play a bit? ;-)

On Edit: More Lighty/Joomla intel:

http://www.google.com/search?q=joomla lighttpd&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Edited by tscheisskopf on 03/16/09 07:16 PM (server time).

Re: switching from Apache to Lighttpd

Posted by: JustinHoMi
Posted on: 2009-03-17 08:00:00

I've had ones of my sites running lighttpd for several days now and haven't had any problems. The site is completely static, which is where lighttpd shines.

I wish there was a way to disable PHP... it uses much more RAM than lighttpd does.

FYI I've run lighttpd/PHP sites in the past, and it went well. But the benefits aren't as great as simple static content.

Re: switching from Apache to Lighttpd

Posted by: sXi
Posted on: 2009-03-17 12:18:00

In reply to:

I wish there was a way to disable PHP... it uses much more RAM than lighttpd does.


DreamHost don't embed the interpreter into the Apache process. Lighty never used mod_php at all.

In reply to:

FYI I've run lighttpd/PHP sites in the past, and it went well. But the benefits aren't as great as simple static content.


The Alexa graphic on the link tscheisskopf provided above your post indicates a tremendous difference in the server's ability to pump out the pages of a dynamic site (Joomla!) after switching from Apache to Lighty.




How To Install PHP.INI / ionCube on DreamHost

Re: switching from Apache to Lighttpd

Posted by: JustinHoMi
Posted on: 2009-03-17 17:29:00

In reply to:

DreamHost don't embed the interpreter into the Apache process. Lighty never used mod_php at all.



Yeah, I know... but that doesn't change the fact that it would be nice to be able to disable php to save RAM.

Re: switching from Apache to Lighttpd

Posted by: sXi
Posted on: 2009-03-17 20:41:00

It might pay to read up on how the webservers work wink




How To Install PHP.INI / ionCube on DreamHost

Re: switching from Apache to Lighttpd

Posted by: JustinHoMi
Posted on: 2009-03-17 21:22:00

On the contrary.

DH is using fastcgi for PHP with lighttpd. Performance is better than running php as a cgi, but you have 2 persistent php processes per domain name.

I have setup lighttpd/fastcgi and apache many, many times. My understanding of the setup is not the issue.

Re: switching from Apache to Lighttpd

Posted by: sXi
Posted on: 2009-03-17 23:06:00

Given your experience with setting up Apache and Lighty multiple times, you'd be aware that both are webservers and don't require PHP to function. The FastCGI process (which is a mod, not core) is not a prerequisite for either Apache or Lighttpd to serve static content.




How To Install PHP.INI / ionCube on DreamHost

Tags: ps thanksphpbbapache