Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-08-2009, 09:35 AM   #1
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
lighttpd and nginx are silly ways to try to reduce load

Recently it's become a fad to put lighttpd or nginx
on top of Apache in a proxying configuration. The idea
is to reduce load. However, many people including
normally competent web hosts don't seem to be taking
a close look at what they are doing first, and not looking
at the cause of the load in the first place before
following this fad. Indeed, for about nine months
lighttpd DID make sense for a very few sites, but with
other options that work better and are simpler, recent
versions of lighttpd never make any sense, once you do
some testing and look into it. I had actually planned
to write a more extensive article on this, with detailed
test results and graphs proving my conclusions as soon
as I got some spare time. It looks like my next "spare
time" will be sometime in 2013, so here's the information
you need, without the pretty graphs.

Webmasters generally say the purpose of using
lightpd or nginx is "to reduce load" or "make the site
faster", which are almost the same thing. Adding lighttpd
in front of Apache, as a proxy, is a really, really bad way
to try to reduce load. Replacing Apache with lighttpd is
almost as bad. There's a much simpler way that works a lot
better, and doesn't have the drawbacks that lighttpd does.
Instead, there's a simple way of reducing load which gives
you lower load than lighttpd, better security, and
far more flexibility.

The first thing I do regarding load takes about five or
ten minutes and often reduces load by 60%-80%. That varies
a lot based on the type of site. Since hard drives are slow
compared to the rest of the system, a site with lots of big
videos can have a bottleneck at the raw speed at which the
drives can deliver the videos, but an 80% reduction in load
average can often be achieved.

I just had to write about this because the 60%-80%
load reduction is SO easy yet most people miss it, even
fairly knowledgeable sysadmins. Most web servers are
pretty much using the default RedHat / CentOS configuration
of Apache which includes pretty much every module that
anyone might ever possibly want to use. Around 55 modules
in total, including modules for autenticating against Microsoft
workgroups servers, modules for trying to automatically
fix mispelled links, six different proxying and load balancing
modules that you almost surely don't need, suexec, which
would be STUPID to use on a dedicated server since it's a
giant security hole, modules for hosting tens of thousands
of home pages using mysite.com/~user/ URLs, modules for
serving the same pages in several different languages, etc.
You are probably using about 6 of these modules, or about 11%.
The other 89% of the Apache code you are loading is complete
waste. Each of these modules gives you features that you
CAN use, if you need them, such as FrontPage extensions.
You can load that module if you need FrontPage extensions,
but if you're not using them it's useless load and you
can just comment out that module and save the load. Contrast
that with lighttpd, where you get what you get. If you
want FrontPage extensions, tough shit - you can't have them
because they're not included. No such thing as a module,
with lighttpd.

We did the testing and this is what we found. By simply
commenting out unused modules and a couple of other simple
settings, Apache is faster than lighttpd, with lower load.
Again, if you want low load, setting up Apache correctly will
give you the least load versus lightttpd and nginx.

It used to be that lighttpd was very fast, largely
because it was very bare bones. Most "features" create some
small amount of load, so they left out 99% of the features
of something like Apache in order to make lighthttpd fast.
What happened a while back is that a few people used lighttpd,
liked it, and started a fad. A bunch of people starting using
lighttpd, each of them wanting a feature or two they were used
to from Apache. Many of those features were added, each one
making lighttpd a little bit slower. It is now measureably
slower than a properly configured Apache installation.
That is of course the key point. If you want a fast server
with low load, testing shows that setting Apache up correctly
gives you lower load than lighttpd does. Yet if and when
you do need to do any proxying, for example, you have six
different proxying modules to choose from that you can load
only if you need one of them, rather than wasting load on
the features you aren't using, as happens with lighttpd and
with your old Apache config.


I also mentioned security. You'll recall that in the
couple of years after PHP became the big fad over 90% of
all server hacks were due to PHP security holes. This was
to be expected because PHP was basically new, so the security
issues hadn't yet been found and addressed. Also, PHP was
designed with one thing in mind - to be easy to use. It
wasn't designed with security in mind, and it showed! Now
lighttpd is in the exact same position. It's newly found
popularity means that the code hasn't been analyzed by thousands
of programmers yet as Apache has been. It's security issues
haven't yet been addressed, but crackers are just now becoming
interested in finding and exploiting those issues. Also like
PHP, lighttpd was designed with one thing in mind - to be light.
It wasn't designed to be secure, and that will show.


Anyway, that's the first thing we do, is get rid of the 39
or so unused Apache modules you're running for every hit.
The second thing I do is to take a quick look at your log
files. I did that on one site server today where a webmaster
was trying out lighttpd and I saw that there was a redirect
loop on one of his scripts. That loop was logging several
error messages per second. Each of those messages represents
ten bogus "hits" being generated by that error. So that one
error was loading the server with around 3,456,000 bogus hits
per day. That's three and a half MILLION hits of load from
that one error. Doesn't fixing the script error make more
sense than dumping the most powerful server software available
in favor of one that hides the error because it's incapable of
handling that feature anyway? Fixing that error and taking
few minutes on your Apache config will give you lower load
than lighttpd without sacrificing power or security.
__________________
For historical display only. This information is not current:
support@bettercgi.com ICQ 7208627
Strongbox - The next generation in site security
Throttlebox - The next generation in bandwidth control
Clonebox - Backup and disaster recovery on steroids
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 09:41 AM   #2
Barefootsies
Choice is an Illusion
 
Barefootsies's Avatar
 
Industry Role:
Join Date: Feb 2005
Location: Land of Obama
Posts: 42,635
:2cents

Interesting read.

Especially in regards to lighttpd.

__________________
Should You Email Your Members?

Link1 | Link2 | Link3

Enough Said.

"Would you rather live like a king for a year or like a prince forever?"
Barefootsies is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 09:41 AM   #3
sandman!
Icq: 14420613
 
sandman!'s Avatar
 
Industry Role:
Join Date: Mar 2001
Location: chicago
Posts: 15,431
A properly setup nginx server will beat the snot out of a properly setup apache server for static content.

Im not a huge fan of running both webservers at the same time tho.
__________________
Need WebHosting ? Email me for some great deals [email protected]
sandman! is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 09:46 AM   #4
HomerSimpson
Too lazy to set a custom title
 
HomerSimpson's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Springfield
Posts: 13,826
nice read...
now could you share with us some more details about what modules most of us really don't need (some list would be nice)...
__________________
Make a bank with Chaturbate - the best selling webcam program
Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!!

PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:
HomerSimpson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 10:00 AM   #5
Mutt
Too lazy to set a custom title
 
Mutt's Avatar
 
Industry Role:
Join Date: Sep 2002
Posts: 34,431
don't alot of people install lighttpd in order to stream Flash videos without the need for the Flash Media Server?
__________________
I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!
Mutt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 10:07 AM   #6
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 22,276
Quote:
Originally Posted by Mutt View Post
don't alot of people install lighttpd in order to stream Flash videos without the need for the Flash Media Server?
This is why I run it
fuzebox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 10:25 AM   #7
Davy
Confirmed User
 
Davy's Avatar
 
Industry Role:
Join Date: Apr 2006
Location: Germany
Posts: 4,323
Thank you for the info, raymor!
__________________
---
ICQ 14-76-98 <-- I don't use this at all
Davy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 10:31 AM   #8
SpaProd
Confirmed User
 
Join Date: Jan 2007
Posts: 150
"to reduce load" != "make the site faster"

Yes a high load will slow down your site, but response time is king in "faster", and nginx will rock Apache any time of day.

If you are moving to nginx or lighttpd to "reduce load" then you have absolutely no idea wtf you are doing. Try fixing a broken leg with a bandaid. #1 cause of load is database's which you don't even mention. Database calls will seriously bottleneck any server, mostly from poorly written calls,bad rows, non optimized *coughWORDPRESScough*.

You mention Frontpage Extensions???? SERIOUSLY? Your load is high and you are running frontpage extensions? Gee I wonder why?
__________________

Redhead Smut
SpaProd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 10:33 AM   #9
HomerSimpson
Too lazy to set a custom title
 
HomerSimpson's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Springfield
Posts: 13,826
Quote:
Originally Posted by HomerSimpson View Post
nice read...
now could you share with us some more details about what modules most of us really don't need (some list would be nice)...
Looks like my apache was built that way so most of the modules are compiled into it.
Modules (LoadModule) that I have in httpd.conf are: mod_frontpage (disabled) mod_auth_passtrough, mod_bwlimited, mod_bw.

So as I found out I can remove/disable rest of modules only by recompiling apache again (easyapache/cPanel)...
__________________
Make a bank with Chaturbate - the best selling webcam program
Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!!

PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:
HomerSimpson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2009, 11:30 AM   #10
Matyko
PsyHead
 
Matyko's Avatar
 
Industry Role:
Join Date: Aug 2005
Location: Hungary
Posts: 8,676
thanks, useful post, even for an almost complete noob like me. i was told to use nginx by my host in order to handle the static content a better way.

Thread forwarded to MojoHost.
__________________
-=- Register with our ref link and we help you with the setup! -=-
AdSpyglass.com - Double your profit from brokers
Matyko is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-09-2009, 11:54 AM   #11
JJdotAM
Registered User
 
Join Date: Apr 2009
Posts: 25
nginx is working better for me than Apache but it doesn't like CentOS5. . .FTP SSH and WHM are terribly slow
JJdotAM is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.