Yaws vs Mochiweb

390 views
Skip to first unread message

Amr Malik

unread,
Nov 6, 2007, 9:59:12 AM11/6/07
to MochiWeb
Hello, how does this differ from Yaws, Thanks, Amr

Bob Ippolito

unread,
Nov 6, 2007, 10:46:08 AM11/6/07
to moch...@googlegroups.com
mochiweb is a minimal and modular set of libraries to build high
performance application specific HTTP servers. Yaws is a complicated
web server that is much more difficult to integrate into other
applications and is not very modular.

However, if you have to ask, Yaws is probably what you want.

-bob

Brian Granger

unread,
Nov 13, 2007, 1:20:16 PM11/13/07
to MochiWeb
Coming from the world of python+twisted, can I think of mochiweb as
being in the same space as twisted.web or twisted.web2? If so, how
does mochiweb compare with these two (in terms of features and
perfomance)? Specifically, I am wondering about full HTTP 1.1.
support.

Thanks

Brian

On Nov 6, 8:46 am, "Bob Ippolito" <b...@redivi.com> wrote:
> mochiweb is a minimal and modular set of libraries to build high
> performance application specific HTTP servers. Yaws is a complicated
> web server that is much more difficult to integrate into other
> applications and is not very modular.
>
> However, if you have to ask, Yaws is probably what you want.
>
> -bob
>

Bob Ippolito

unread,
Nov 13, 2007, 2:25:45 PM11/13/07
to moch...@googlegroups.com
It's not really like python+twisted, it's not very framework-like and
it works at a much lower level. You basically get a socket and some
convenience functions (so that you rarely ever have to touch the
socket, but you could if you wanted to).

The performance is orders of magnitude better than Twisted in my experience.

It supports HTTP 1.1 in that it can parse HTTP 1.1 headers, does
keep-alive correctly, and it gives you functions to write a chunked
response or parse a multipart POST but it doesn't do anything with
regard to caching or files (though it gives you a function that can be
used to serve files).

It hasn't really been tested on the open internet, we use nginx as the
front-end HTTP server which load balances to mochiweb instances on
various machines in the cluster.

-bob

Brian Granger

unread,
Nov 13, 2007, 3:42:29 PM11/13/07
to moch...@googlegroups.com
> It's not really like python+twisted, it's not very framework-like and
> it works at a much lower level. You basically get a socket and some
> convenience functions (so that you rarely ever have to touch the
> socket, but you could if you wanted to).

That makes sense.

> The performance is orders of magnitude better than Twisted in my experience.

Wow, that is pretty amazing. It is not like Twisted is super slow.
Do you have any sense of why this is the case?

> It supports HTTP 1.1 in that it can parse HTTP 1.1 headers, does
> keep-alive correctly, and it gives you functions to write a chunked
> response or parse a multipart POST but it doesn't do anything with
> regard to caching or files (though it gives you a function that can be
> used to serve files).

I am looking for something low-level so this is just fine.

Brian

Bob Ippolito

unread,
Nov 13, 2007, 6:18:27 PM11/13/07
to moch...@googlegroups.com
On 11/13/07, Brian Granger <elliso...@gmail.com> wrote:
>
> > It's not really like python+twisted, it's not very framework-like and
> > it works at a much lower level. You basically get a socket and some
> > convenience functions (so that you rarely ever have to touch the
> > socket, but you could if you wanted to).
>
> That makes sense.
>
> > The performance is orders of magnitude better than Twisted in my experience.
>
> Wow, that is pretty amazing. It is not like Twisted is super slow.
> Do you have any sense of why this is the case?

The networking core of Erlang is pretty much all C code, and Twisted
builds like seven layers of abstraction on top of the _socket module?
There's probably a lot less memory mangling with iolist than with
Twisted's buffers... I'm not sure exactly, I didn't care to dig too
deep into the differences. mochiweb (ab)uses undocumented HTTP header
parsing code in the Erlang VM, so that might account for some of it.

I built a prototype with Erlang and it was so much faster than Twisted
that I thought it was broken. Turned out it wasn't, and I haven't
looked back. I also find Erlang code easier to reason about than
Twisted code, and we take advantage of Erlang inter-node messaging and
mnesia, so Python isn't really all that appealing to us any more for
heavy networking tasks (we still use Python for ETL and the web UI).

> > It supports HTTP 1.1 in that it can parse HTTP 1.1 headers, does
> > keep-alive correctly, and it gives you functions to write a chunked
> > response or parse a multipart POST but it doesn't do anything with
> > regard to caching or files (though it gives you a function that can be
> > used to serve files).
>
> I am looking for something low-level so this is just fine.

Then mochiweb is probably appropriate for what you're doing.

-bob

Reply all
Reply to author
Forward
0 new messages