[web-devel] [WAI] Switching to WAI/Warp...

Bardur Arantsson spam at scientician.net
Mon Feb 21 18:19:56 CET 2011

On 2011-02-20 12:08, Michael Snoyman wrote:
> On Sun, Feb 20, 2011 at 12:00 PM, Bardur Arantsson<spam at scientician.net>  wrote:
>> On 2011-02-20 10:29, Michael Snoyman wrote:
>>> On Sun, Feb 20, 2011 at 11:04 AM, Bardur Arantsson<spam at scientician.net>
>>>   wrote:
>> [--snip--]
> It's entirely possible that WAI/enumerators/builder/Warp is adding
> some overhead. But what exactly are you comparing against? Warp is
> *definitely* doing some extra stuff that a simple Data.ByteString.hPut
> is not, such as timeout handling. I'd be interested in any numbers
> that you come up with from profiling, please do share.

Silly of me, I should have explained properly: I'm comparing against a 
simple monadic HTTP server using the "HTTP" module for parsing/rendering 
requests and response headers (so regular Strings) and simple (strict) 
bytestring output in the IO monad. Socket operations were handled using 
the network/network-bytestring packages.

While I can readily accept a little extra overhead from a more elegant 
model like WAI/Warp, I don't think 5-10% CPU usage is reasonable for 
streaming data to a *single* client on a reasonably beefy 2.4GHz Core2 CPU.

Given the Warp benchmarks that have been posted and the fact that my 
(admittedly slightly simpler) http server uses around 0-1% CPU, that 
makes me think that I'm probably doing something wrong.

Anyway, I'll see about producing some proper benchmarks (probably not 
until the weekend, though) and I guess I/we can take it from there.


More information about the web-devel mailing list