[web-devel] simple-sendfile

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Wed Jun 15 03:43:52 CEST 2011


Hello,

I have uploaded the simple-sendfile package to HackageDB.

	http://hackage.haskell.org/package/simple-sendfile

This is a simple version of the sendfile package which use unnecessary
system calls (stat() and lseek()). 

The simple-sendfile package provides native sendfile support for
Linux, BSDs, and MacOS. For other OSes, a fallback function using
read()/send () is provided.

Since the limitation of sendfile on Linux, stat() is called if
EntireFile is used. But we can use PartOfFile instead to send entire
files.

I modified Warp to make use of the simple-sendfile package.

	https://github.com/kazu-yamamoto/warp/commit/fd73ffb098475255756f7706f8328513643ed20c

And I confirmed that performance becomes much better. I'm very
satisfied with the current performance.

Since I don't know how T.Handle should be used, the commit above just
ignores T.Handle at this moment. If necessary, I would love to modify
the API of the simple-sendfile package.

--Kazu



More information about the web-devel mailing list