This project is read-only.

My new framework

Topics: blog
Apr 19, 2012 at 7:31 PM
Edited Apr 19, 2012 at 7:41 PM

I've added my next networking framework to GitHub: https://github.com/jgauffin/griffin.networking

I'm working on a HTTP implementation. Did a small test the other day using Apaches "ab" tool:

 

Requests per second:   259.64 [#/sec] (mean)
Time per request:       3.851 [ms] (mean)
Time per request:       3.851 [ms] (mean, across all concurrent requests)
Transfer rate:             33.47 [Kbytes/sec] received

 

259 requests per second is OK by me since I've not done any optimizations yet. The test run was made for 5000 requests. The server had allocated 50MB after the tests.

The HTTP listener setup:

 

var factory = new DelegatePipelineFactory();
factory.AddDownstreamHandler(() => new ResponseEncoder());
factory.AddUpstreamHandler(() => new HeaderDecoder(new HttpParser()));
factory.AddUpstreamHandler(() => new MessageHandler());

HttpListener listener = new HttpListener(factory);
listener.Start(new IPEndPoint(IPAddress.Any, 8080));

 

I'll post an article about the framework at codeproject.com probably next week.

Apr 24, 2012 at 1:29 AM

How do Websockets come into play here?

Apr 27, 2012 at 9:48 AM

There will be a WebSocket implementation for the framework eventually.

Nov 27, 2012 at 10:17 AM
Edited Nov 27, 2012 at 10:17 AM

Does your new framework support streaming over HTTP using the range headers? (Accept-Range, Content-Range, Range etc).

Nov 27, 2012 at 12:16 PM

Of course. You can transfer files that are several GB large without increasing the memory foot print. I'm coding a simple sample which will be done tonight.

I'm going to integrate the range handling in the file module later.

Dec 3, 2012 at 2:09 PM

The support for HTTP ranges are now included: http://blog.gauffin.org/2012/12/griffin-networking-added-support-for-http-ranges/

Dec 13, 2012 at 8:48 AM

Had a first look at the new webserver. Well done!

Here are a few things I found:

  1. BodyDecodingModule, HandleRequest, "context.Request.Body.Position = 0;" will throw if Body is null.
  2. DiskFileService, GetFullPath, you should do HttpUtility.UrlDecode(relativeUri).
  3. FileModule, HandleRequest, should set 404 if not found (before returning ModuleResult.Continue)
  4. I can't get any request cookie data (not working/implemented?)

So this looks really promising. Keep up the good work!

Dec 13, 2012 at 9:11 AM

I would love if you cloned the repos and made pull requests with contributions :) I've also created a Google Group that we can use for discussions: https://groups.google.com/forum/#!forum/griffin-webserver

Great points. Feel free to add them as issues in the issue tracker at github.

Regarding #3: It's better to have a 404 module which would run last in the module queue.  In that way you can also take actions on all 404s (logging, notifications, statistics etc).

Dec 13, 2012 at 2:08 PM

I've fixed the cookie handling. It was not complete.

Also fixed the body decoding where it's no body :)

Feel free to contribute with code changes.

Let's continue the discussion in the google group