Just a quick update on the status of Kayak.
The framework part of Kayak is no more. No more KayakService, no more [Path] and [Verb] attributes. Going forward Kayak is only a web server. I was never very happy with the structure of the framework bits—I could never get it to be sufficiently modular in a satisfying way. I realize now that a composition of OWIN 'middleware' is the best way to approach issues like routing, method invocation, [de]serialization, authentication, and the like. Furthermore, I no longer feel that C# is well-suited to writing user-facing web frameworks. I may revisit the framework later, likely as a separate F# project which is pitched as a collection of OWIN middleware.
Upcoming for Kayak-the-web-server:
- Significantly improved performance, memory efficiency, standards-compliance, and security of request parsing, with HTTP/1.1 support. I'm making a new evented HTTP parser using Ragel (see: https://github.com/bvanderveen/httpmachine)
- A new IO engine based on Oars, my libevent2 bindings for C# (see: http://code.google.com/p/oars/). This will significantly improve the performance of Kayak on Mono, making it a single-threaded, evented server. The existing native .NET IO engine (based on System.Net.Sockets.Socket) will continue to be supported for .NET and Mono (and .NET Micro Framework, if it's not too hard).
- Full support of the final OWIN spec. OWIN is super, super close to being 1.0, and as soon as it is, Kayak will be a best-of-breed OWIN host implementation.
I realize that to date I have not been the best steward of an open source project in terms of releases, making the source code easy to build and test, accurate and up-to-date website/documentation, etc. This is something I want to get better at in the future, but as a one-man show my resources are limited. So, I'm very grateful for everyone's bug reports, suggestions for how to make Kayak easier to learn about, hack on and use, etc—keep them coming! My head is very much in the guts of Kayak and I appreciate any help making Kayak easier for developers to use.
Kayak is approaching a stable state and I look forward to a 1.0 release in the coming months. Thank you for your continued interest, and please stay tuned.
Benjamin
> Some clarification about how Mono thread pools are related to Socket
> asynch IO:
>
> In Mono, prior to the upcoming 2.10, async socket calls add the socket
> to epoll(linux)/poll(everything else). Once the socket is ready, a
> work item is queued in the IO thread pool and once that is executed,
> the callback, if any, is scheduled in the regular thread pool.
>
> As of 2.10, the socket is still added to epoll/poll but using a faster
> code path, the work item in the IO thread pool is faster and the
> callback is scheduled into the regular thread pool from unmanaged code
> whenever possible. Also SocketAsyncEventArgs support is properly
> implemented. There were also a bunch of nice improvements to the
> regular threadpool in Mono 2.8+: per threadpool thread work-stealing
> queues, lock free scheduling when adding a threadpool work item from a
> threadpool thread, much better dynamic adjustment of the number of
> threadpool threads based on workload,...).
>
> -Gonzalo
>
This is great information Gonzalo, thank you for clarifying! I'll definitely play with this when 2.10 comes round.
> Ok so the httpmachine is based on c code.
HttpMachine is a C# library. It uses Ragel to generate a state machine. Ragel supports several other languages (including C), so it would be easy to port HttpMachine to any language supported by Ragel.
> this all sounds very much like NodeJS. By this i mean that you code in c#, but the underlying performance and good stuff is provided by highly optimised code that just gets the job done.
It's somewhat similar, but Kayak is largely implemented in C#. It will be possible to have an unmanaged IO loop however (node also takes this approach).