[web-devel] Looking for criticism and comments on web-mongrel2.

Michael Snoyman michael at snoyman.com
Fri Jan 21 14:44:49 CET 2011

On Fri, Jan 21, 2011 at 3:40 PM, Clint Moore <cmoore at wamboli.com> wrote:
> On Fri, Jan 21, 2011 at 5:28 AM, Michael Snoyman <michael at snoyman.com> wrote:
>> On Fri, Jan 21, 2011 at 2:30 PM, Clint Moore <cmoore at wamboli.com> wrote:
>> Looks like you've done a good job so far, and have even put in a fair
>> amount of docs. Impressive! Just some minor thoughts:
> Well thanks for the encouragement!
>> * I think you should consider using ByteStrings instead of Strings in
>> a lot of places (eg, headers).
> Ugh!  I forgot to include in my email that that was the first thing I
> am going to do.  I'm actually working on that now.
>> * In m2_parse, it looks to me like usage of Parsec is overkill, since
>> a simple break would work. As a plus, if you also switch to
>> ByteString, you could use breakByte which will give you a highly
>> optimized parsing function.
> Now this I wouldn't have thought of.  I'll go back into m2_parse and
> look it over again.
>> * For response_body, I'd **really** avoid usage of String. In fact,
>> some form of enumerator would be very good there. But at the very
>> least, please switch to a lazy ByteString.
> Yep, definitely bytestrings everywhere.  I guess I was overly excited
> to get it in front of someone and kinda jumped the gun on releasing
> it.  There'll be a new version tomorrow.
>> I can't really say too much more without knowing more of the internals
>> of zeromq and mongrel2, but I think this is a good project to have
>> going for the Haskell community. Thank you.
> Again, I appreciate the complement!
>> Obviously I'm biased here, but I'd love to see a WAI wrapper for
>> mongrel2. Would you be interested in either having this package
>> provide a WAI interface, or writing a separate package that wraps this
>> package and provides one? I'd be happy to offer some help if you're
>> interested.
> One of the reasons the handler is so simply implemented is so that, at
> least I hope, is that it makes it very simple to implement handlers.
> Incidentally, WAI was the first library I was going to start with for
> implementing some handlers myself.  I figure the more handlers I write
> the more bugs I'll catch.

Glad to hear you were already working on the bytestring switch, I hope
I didn't focus on that too much ;). If you *are* planning on writing a
WAI handler for this, you will need to provide something more powerful
for the response body than lazy bytestrings. Well, either that, or use
some ugly forkIO/unsafeInterleaveIO tricks that I don't mention in
polite company.

Out of curiosity, does mongrel2 provide any kind of optimization for
serving files via a sendfile system call? I would be surprised if it


More information about the web-devel mailing list