You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by howard chen <ho...@gmail.com> on 2007/02/26 17:05:08 UTC

What do you think about Lighttpd?

Can anyone give some comments abt in their implementations which are
difference from Httpd on the following area:

1. single-threaded, event-based, (powered by epoll)
2. fast cgi support


seems that these two points are quite attractive to use, why seldom
heard abt them in Httpd world?

:)

Thanks for any comments.

Re: What do you think about Lighttpd?

Posted by Bill Stoddard <bi...@wstoddard.com>.
>> Since Apache 2.0, we've had the MPM architecture, which means you can
>> plug in your choice of processing model.  That's also how Apache 2
>> works cross-platform, rather than being (like Apache 1) a Unix server
>> ported with lots of compromises in performance/etc to other platforms.
>>
>
> i was surprised that event based MPM did not catch too much attention
> of Apache developers? maybe i am wrong? :)
Howard,
Well, your both right and wrong :-)  The event driven network i/o model 
is really powerful and as you say, it can be much more robust as 
compared to a threaded process model, and it's also very scalable (think 
large number of concurrent clients). Here are what I see as the two 
basic problems:
 
1. Apache httpd runs everywhere or nearly so. Most platforms have their 
own event driven network i/o APIs (epoll, KQueue, aio, and so forth). 
Some platforms (notably Windows) have async network i/o APIs which means 
you also have to allocate and manage i/o buffers across your network i/o 
calls.  We've never quite settled on the right abstraction layer that is 
both portable, performs well and accommodates platforms that have more 
traditional network i/o models.
 
2. The core Apache httpd architecture is not really suited for use with 
an event driven/async network i/o API.  Yes we made the event MPM work , 
but it feels kinda hackish to me (and I helped do the work so I gotta 
right to criticize :-).  Someone recently suggested making the core 
httpd engine a state server; i really like that idea and maybe it will 
be a feature of 'amsterdam'. We'll see.

Bill



Re: What do you think about Lighttpd?

Posted by steve <ia...@gmail.com>.
Ah, OK.... so I shouldn't panic until a browser ships with pipelining
enabled by default. HTTP pipelining would be nice, as in limited
tests, it had a nice performance increase on sites with lots of little
images/css/etc.

On 3/1/07, Greg Ames <am...@yahoo.com> wrote:
>
> --- steve <ia...@gmail.com> wrote:
>
> > > I use it too, and have meddled with it enough at a source level to feel
> > > comfortable running it. It has obvious, documented, problems (don't use
> > > it with mod_ssl),
> >
> > I didn't make it clear earlier -- I do use the event mpm.
> > Successfully. What *is* the problem with mod_ssl anyway??? I have used
> > the two together, and I haven't seen a problem....
>
> I had something to do with the event mpm also, but I've been out of the loop on
> it for some time, so the following may not be quite right.
>
> basically mod_ssl's input filters and check_pipeline_flush() have different
> views of how to tell when there is no more input data queued.  there used to be
> the possibility that when a client uses HTTP pipelining (multiple requests
> back-to-back without waiting for a response after each), mod_ssl could have
> data stashed in its input filters for requests after the first request, and the
> httpd core (check_pipeline_flush() ) wouldn't realize it and make a bad
> decision.  that could result in hangs or lost input.  you are unlikely to see
> this problem without pipelining enabled in a browser.
>
> it's fixable, just a simple matter of programming...
>
> Greg
>
>
>
> ____________________________________________________________________________________
> Sucker-punch spam with award-winning protection.
> Try the free Yahoo! Mail Beta.
> http://advision.webevents.yahoo.com/mailbeta/features_spam.html
>

Re: What do you think about Lighttpd?

Posted by Greg Ames <am...@yahoo.com>.
--- steve <ia...@gmail.com> wrote:

> > I use it too, and have meddled with it enough at a source level to feel
> > comfortable running it. It has obvious, documented, problems (don't use
> > it with mod_ssl),
> 
> I didn't make it clear earlier -- I do use the event mpm.
> Successfully. What *is* the problem with mod_ssl anyway??? I have used
> the two together, and I haven't seen a problem....

I had something to do with the event mpm also, but I've been out of the loop on
it for some time, so the following may not be quite right.

basically mod_ssl's input filters and check_pipeline_flush() have different
views of how to tell when there is no more input data queued.  there used to be
the possibility that when a client uses HTTP pipelining (multiple requests
back-to-back without waiting for a response after each), mod_ssl could have
data stashed in its input filters for requests after the first request, and the
httpd core (check_pipeline_flush() ) wouldn't realize it and make a bad
decision.  that could result in hangs or lost input.  you are unlikely to see
this problem without pipelining enabled in a browser.

it's fixable, just a simple matter of programming...

Greg


 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

Re: What do you think about Lighttpd?

Posted by steve <ia...@gmail.com>.
> I use it too, and have meddled with it enough at a source level to feel
> comfortable running it. It has obvious, documented, problems (don't use
> it with mod_ssl),

I didn't make it clear earlier -- I do use the event mpm.
Successfully. What *is* the problem with mod_ssl anyway??? I have used
the two together, and I haven't seen a problem....

BTW: FastCGI is not necessary as you can use all Apache all the time:

1. Compile once Apache 2.2 with the event MPM. This is your normal web
server on port 80.

2. Compile another Apache 2.2 with the prefork MPM and mod_php. This
is your PHP server. Run it on another port.

3. Use Apache's rewrite and proxy to forward the php requests from #1
server to #2 server. It seems a little heavy, but you can eliminate
FastCGI altogether. If needed, you can also have your "PHP" server on
another machine than your "Web" server. And you can have more PHP
servers and use the proxy balancer to load balance them.

Just seems a bit heavy weight when its going on a single machine. I
don't have real numbers on how much more weight this is than using
FastCGI. Anyone know? Config would be easier though... :)

Some questions:

1. What is the issue with event mpm and mod_ssl to a end-user?
2. How much more "heavy" is the above setup than using FastCGI?
3. If keep-alive were on both servers (#1 to end users, numbering in
the thousands, and #2 only as many as there are processes), does it
work? Another way of saying it is: does mod_proxy keep connections to
the other server if keep-alive is enabled? is there some other setting
that does this?

Re: What do you think about Lighttpd?

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Wed, Feb 28, 2007 at 01:32:44PM -0800, Paul Querna wrote:
> steve wrote:
> > On 2/27/07, Arnold Daniels <in...@adaniels.nl> wrote:
> >> Nick already told you, that Apache allows you to choose. So simply use
> >> the fast-cgi/mpm-event combo, if you like that best. And if you want to
> >> evangelize the combo, nobody is stopping you.
> > 
> > I use this and it works fine. However:
> > 
> > 1. The event MPM is EXPERIMENTAL. No telling when it will be deemed as
> > production ready.
> 
> .....  I dunno. I use it. (I also helped write it, soo...)

I use it too, and have meddled with it enough at a source level to feel
comfortable running it. It has obvious, documented, problems (don't use
it with mod_ssl), but it's pretty good at what it's supposed to be
pretty good at :-)

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net

Re: What do you think about Lighttpd?

Posted by Paul Querna <ch...@force-elite.com>.
steve wrote:
> On 2/27/07, Arnold Daniels <in...@adaniels.nl> wrote:
>> Nick already told you, that Apache allows you to choose. So simply use
>> the fast-cgi/mpm-event combo, if you like that best. And if you want to
>> evangelize the combo, nobody is stopping you.
> 
> I use this and it works fine. However:
> 
> 1. The event MPM is EXPERIMENTAL. No telling when it will be deemed as
> production ready.

.....  I dunno. I use it. (I also helped write it, soo...)

> 2. The FastCGI support from Apache is, well, not there.
....
> 3. The FastCGI apache module has not been updated in YEARS.
....
> 

Have you tried mod_fcgid?
http://fastcgi.coremail.cn/

It fixes these two problems at least.


Re: What do you think about Lighttpd?

Posted by steve <ia...@gmail.com>.
On 2/27/07, Arnold Daniels <in...@adaniels.nl> wrote:
> Nick already told you, that Apache allows you to choose. So simply use
> the fast-cgi/mpm-event combo, if you like that best. And if you want to
> evangelize the combo, nobody is stopping you.

I use this and it works fine. However:

1. The event MPM is EXPERIMENTAL. No telling when it will be deemed as
production ready.

2. The FastCGI support from Apache is, well, not there. You will have
to go out and get a third party module. Also, that doesn't compile. So
you will need a patch from a fourth party to get it to even compile.

3. The FastCGI apache module has not been updated in YEARS. So don't
expect improvements. I don't know if it even persists connection to
the FastCGI processes. However, Apache may include a FastCGI module in
2.4, and it should get load balancing support of some sort as it works
off the proxy balancer, etc., bringing it closer in line with
Lighttpd. But it could easily be over a year. And it might only be
EXPERIMENTAL. I know there are a bunch of very talented people on the
Apache team, but I'm not sure any of them actually works on it full
time. Sorta curious.

4. If you are planning to do something that holds connections for long
periods of time (PUSH/COMET/etc), I think Apache is out. Lightthd has
some ideas for handling this in server. If you were to write something
yourself, it is far easier to do your own server in perl or php than
to add the functionality to Apache. Search for chat servers for source
(like jabberd from Live Journal for a perl version, I have a php one
but can't remember where it came from at the moment).

All rant aside, it is not that hard to compile the fastcgi module with
the patches and compile apache with the event mpm. You had better have
the stomach for experimental code, and the fastcgi setup and tuning is
pure crap. The fastcgi setup and tuning is pure crap. Yes, I repeated
that. :)

But in the end, it works. And nothing says "I believe" like using it
yourself. Successfully.

Re: What do you think about Lighttpd?

Posted by Arnold Daniels <in...@adaniels.nl>.
Howerd,

PHP does not recommend running php as a module in a threaded 
environment, because a number of PHP extensions are not thread-safe. 
Apache2 MPM-prefork will run just fine with php as module.

Nick already told you, that Apache allows you to choose. So simply use 
the fast-cgi/mpm-event combo, if you like that best. And if you want to 
evangelize the combo, nobody is stopping you.

There not much more to say about this topic, so please consider it closed.

Best regards,
Arnold


howard chen wrote:
> On 2/27/07, Nick Kew <ni...@webthing.com> wrote:
>> You have the choice.  If more people use mod_php than fastcgi,
>> that's because they're choosing it.
>
> yes, this is really interesting. sometimes i really don't understand 
> them...
> especially php does not recommended threaded MPM in apache2...so
> continue to use apache 1.x ?
>
> :)
>
>> Since Apache 2.0, we've had the MPM architecture, which means you can
>> plug in your choice of processing model.  That's also how Apache 2
>> works cross-platform, rather than being (like Apache 1) a Unix server
>> ported with lots of compromises in performance/etc to other platforms.
>>
>
> i was surprised that event based MPM did not catch too much attention
> of Apache developers? maybe i am wrong? :)
>
>
> howa

Re: What do you think about Lighttpd?

Posted by howard chen <ho...@gmail.com>.
On 2/27/07, Nick Kew <ni...@webthing.com> wrote:
> You have the choice.  If more people use mod_php than fastcgi,
> that's because they're choosing it.

yes, this is really interesting. sometimes i really don't understand them...
especially php does not recommended threaded MPM in apache2...so
continue to use apache 1.x ?

:)

> Since Apache 2.0, we've had the MPM architecture, which means you can
> plug in your choice of processing model.  That's also how Apache 2
> works cross-platform, rather than being (like Apache 1) a Unix server
> ported with lots of compromises in performance/etc to other platforms.
>

i was surprised that event based MPM did not catch too much attention
of Apache developers? maybe i am wrong? :)


howa

Re: What do you think about Lighttpd?

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 27 Feb 2007 21:37:29 +0800
"howard chen" <ho...@gmail.com> wrote:

> Hello,
> 
> Thanks for your reply first.
> 
> I understand Apache already support fastcgi, however, phper most
> likely will prefer mod_php, so fastcgi in Apache is not as popular as
> in other http servers.

You have the choice.  If more people use mod_php than fastcgi,
that's because they're choosing it.

> Similarly, later Apache 2.x might officially support event based model
> rather than multi-process one.

Apache 2.2 does, if you want it to.

Since Apache 2.0, we've had the MPM architecture, which means you can
plug in your choice of processing model.  That's also how Apache 2
works cross-platform, rather than being (like Apache 1) a Unix server
ported with lots of compromises in performance/etc to other platforms.

> We know that fastcgi & event based model have some very attractive
> reasons, such as better usage of cpu time, more robust even under high
> loading.

Do we?  Of course you can set up test cases where that applies.
Or the opposite.

> I am not asking whether/when Apache support these functions, I want to
> learn more abt from the Apache httpd developers, their way of thinking
> behind these approaches..why they are not good or not suitable in
> Apache, why?

Apache gives you the choice.  Write a new MPM to drive it as you want.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Re: What do you think about Lighttpd?

Posted by howard chen <ho...@gmail.com>.
Hello,

Thanks for your reply first.

I understand Apache already support fastcgi, however, phper most
likely will prefer mod_php, so fastcgi in Apache is not as popular as
in other http servers.

Similarly, later Apache 2.x might officially support event based model
rather than multi-process one.

We know that fastcgi & event based model have some very attractive
reasons, such as better usage of cpu time, more robust even under high
loading.

I am not asking whether/when Apache support these functions, I want to
learn more abt from the Apache httpd developers, their way of thinking
behind these approaches..why they are not good or not suitable in
Apache, why?

I belive there must be some reasons behind. :)


Thanks.

howa


On 2/27/07, Arnold Daniels <in...@adaniels.nl> wrote:
> Hi,
>
> 1. Apache 2.2 can be used event based request handling, though is is
> still under development. http://httpd.apache.org/docs/2.2/mod/event.html
> 2. Apache supports fast cgi

Re: What do you think about Lighttpd?

Posted by Arnold Daniels <in...@adaniels.nl>.
Hi,

1. Apache 2.2 can be used event based request handling, though is is 
still under development. http://httpd.apache.org/docs/2.2/mod/event.html
2. Apache supports fast cgi

Best regards,
Arnold

howard chen wrote:
> Can anyone give some comments abt in their implementations which are
> difference from Httpd on the following area:
>
> 1. single-threaded, event-based, (powered by epoll)
> 2. fast cgi support
>
>
> seems that these two points are quite attractive to use, why seldom
> heard abt them in Httpd world?
>
> :)
>
> Thanks for any comments.

Re: What do you think about Lighttpd?

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Tue, Feb 27, 2007 at 12:05:08AM +0800, howard chen wrote:
> 1. single-threaded, event-based, (powered by epoll)

httpd supports epoll() and event-based polling to the extent that the
system-call chains for handling a request by Apache httpd and lighttpd
are near-identical, it's hard to tell them apart using strace. The time
it takes the system calls to return completely dwarfs the CPU time spent
in actual code in my experience.  

Even with the worker MPM. using epoll gets Apache httpd and lighttpd
similar enough to the point that any difference is statistical noise -
though lighttpd is nearly always better for memory consumption.

That said, httpd ships with poor configuration defaults for achieving
this kind of performance (though are good reasons why those defaults are
suitable generally) compared to lighttpd (which does it practically out
of the box).

In general, the extent of any performance difference is pretty hard to
substantiate (and I've tried, though a systematic bias is that I'm
vastly more familiar with httpd code and know how to tune it better!)
and definitely over-stated. 

Either way, both servers are performant on regular hardware to an extent
that they will never prove to be the problem in any scalability
scenario. Each is capable of 100k and more concurrent requests and tens
of thousands of requests per second, if really really pushed. Other
kinds of limits will kick in *long* before the code in either httpd or
lighttpd is a problem, at the end of the way a webserver just boils down
to a handful of system calls. 

In the context of web-servers, performance comparisons are basically
bar-chart pornography, and of little real-world utility. Hell, even IIS
is usable these days. Better to concentrate on the feature-set and how
each server helps you do whatever it is you want better.

> 2. fast cgi support

lighttpd's is better. httpd's is improving all the time though.

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net