Subject: Re: [boost] C++ Networking Library Release 0.5
From: Peter Petrov (ppetrov_at_[hidden])
Date: 2010-02-01 18:09:30
On Mon, Feb 1, 2010 at 11:28 PM, James Mansion <james_at_[hidden]
> Peter Petrov wrote:
>> First, Spirit is unsuitable for the task - it consumes all the input in
>> pass, and doesn't support the case when the HTTP request arrives in more
>> than one read. The real solution is a state-machine-based parser, just
>> the one in the Asio HTTP example.
> I'd agree with your preference for a passive state-machine based handler,
> and also that Ragel is an
> excellent tool - but surely the alternative is 'just' that the spirit
> parser must block waiting for more
> input. Either using a thread or a coroutine.
Agreed threads are alternative, but only for small servers without high
scalability requirements (e.g. tens of thousands simultaneous HTTP
keep-alive connections). The thread-per-connection model is outdated and in
2010 it's not a good idea to start a framework which relies on it.
Coroutines could work, though I doubt the complexity (e.g. using yielding
iterators with Spirit) or performance will be any better than simply using a
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk