On Sun, Apr 15, 2012 at 6:27 AM, goughy <[email protected]> wrote: > Hi, > > I have just finished the first cut of an HTTP library to provide > application level support for HTTP (ie as a server, not a client). The > library provide a very simple mechanism for processing HTTP requests both > synchronously (via delegates) and asynchronously (via std.concurrency) > using request/response objects. > > eg. > > import std.stdio; > import protocol.http; > > int main( string[] args ) > { > httpServe( "127.0.0.1", 8888, > (req) => req.getResponse(). > status( 200 ). > header( "Content-Type", "text/html" ). > content( "<html><head></head><body>**Processed > ok</body></html>" ) ); > return 0; > } > > The code is available on github: https://github.com/goughy/d/** > tree/master/http4d <https://github.com/goughy/d/tree/master/http4d> > > Note that this is alpha quality code, so YMMV. I would appreciate some > feedback, critiques, opinions etc. - particularly in the area of it being > "idiomatic" as I'm still finding my feet in the D language. > > The good thing is without any real performance tuning, I can push through > over 23,000 requests per second, and I'm sure there is plenty of room for > improvement. > > Cheers. > > > Neat. I like the integration with std.concurrency and the API in general (though I too am still trying to get a feel for idiomatic D). How does 23,000 requests/sec compare to, say, nginx's performance (which seems to be the current performance king)? I just tried to look up some general performance figures but they are all over the place and don't correspond to your machine in any case.
I just watched the Go talk from Lang.NEXT and he uses Go's standard HTTP library and it made me a little jealous. Perhaps this would be a good candidate for Phobo's HTTP library. Regards, Brad Anderson
