scalable-server-0.2.2: Library for writing fast/scalable TCP-based services





ScalableServer is a library that attempts to capture current best practices for writing fast/scalable socket servers in Haskell.

Currently, that involves providing the right glue for hooking up to enumeratorattoparsec-enumeratorblaze-builder and network-bytestring

It provides a relatively simple parse/generate toolchain for plugging into these engines

Servers written using this library support pipelining; that is, a client can issue many requests serially before the server has responded to the first

Server written using this library also can be invoked with +RTS -NX invocation for multicore support

runServer :: RequestPipeline a -> PortNumber -> IO ()Source

Given a pipeline specification and a port, run TCP traffic using the pipeline for parsing, processing and response.

Note: there is currently no way for a server to specific the socket should be disconnected

data RequestPipeline a Source

The RequestPipeline acts as a specification for your service, indicating both a parser/request object generator, the RequestCreator, and the processor of these requests, one that ultimately generates a response expressed by a blaze Builder


RequestPipeline (RequestCreator a) (RequestProcessor a) PipelineSize 

type RequestCreator a = Parser aSource

The RequestCreator is an Attoparsec parser that yields some request object a

type RequestProcessor a = a -> IO BuilderSource

The RequestProcessor is a function in the IO monad (for DB access, etc) that returns a builder that can generate the response