Static Content

5 views
Skip to first unread message

Jason Reid

unread,
Oct 21, 2009, 4:02:31 PM10/21/09
to magnum-py
Is this really as good as nginx and lighttpd for serving static
content? Does it support the X-SENDFILE header?

gattis

unread,
Oct 21, 2009, 4:21:12 PM10/21/09
to magnum-py
I'm not sure it will ever beat nginx or lighttpd for serving static
content, but it should come pretty close. The fastest way to serve
static content with Linux is a combination of two high performance
system calls: 1) epoll, which monitors incoming socket events and 2)
sendfile which can remap a socket connection to a disk file descriptor
at the OS level. Nginx and lighttpd use both of these calls. Magnum
currently uses epoll, but sendfile hasn't been added yet. Even once
sendfile is implemented, there probably won't be any difference
between nginx/lighttpd and Magnum for static files except for the
python interpretation layer for Magnum, which will slow it down a tiny
bit. Since sendfile just tells the OS to remap a particular file
descriptor to a particular socket, the http daemon isn't doing much at
all, so the python layer won't make much of a difference, but I doubt
it would be faster.

Dynamic content is a whole different story though, and Magnum has many
edges there. If you're going to pick one server to serve everything,
Magnum should have a huge upside on the dynamic side and not much
downside on the static side.
Reply all
Reply to author
Forward
0 new messages