GithubHelp home page GithubHelp logo

modulexcite / comet-server-for-asp.net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dnewcome/comet-server-for-asp.net

0.0 2.0 0.0 109 KB

Simple http server-push registration using async http handlers in ASP.NET

C# 95.16% ASP 4.84%

comet-server-for-asp.net's Introduction

This project is an extremely simple and naive implementation of a Comet-like
event registration and notification mechanism that is implemented using ASP.NET's
IHttpAsyncHandler interface.

The ASP.NET Comet server consists of two main parts: the client registration
handler Register.ashx, and the notification page Notify.aspx. The notification
page isn't really designed for use in any programmatic way, but rather as a 
sample implementation that calls the notification methods on the handler class.

There are several drawbacks with using ASP.NET for tracking client registrations.
If the worker process is recycled, we lose all client registration information.
Ideally, we would be able to persist this information in another way, but
we ultimately need to keep some persistent process in order to track sockets
and/or HttpContexts. Another is that we have to be careful about concurrent access
to the client registration data. I've put some very crude locking in place that
is probably very ineffecient.

In my testing, I was able to get over 16,000 clients registered using the 
commandline test client. In order to achieve this, you will need to be using
Server 2003 or Server 2008 with some tweaks to machine.config etc. The limit
seems to be in the way that .net handles socket buffers, but I'm not entirely
sure. Some sources indicate that we should be able to get 70,000+ Tcp connections
with Windows, but perhaps it is not possible using .net (using multiple 
ApplicationPools doesn't seem to make any difference on the limit).

when I first messed around with this idea, I was trying to just periodically
send some data down to the client. These old experiments can be found in the 
`old-files' folder.  In the case of async.aspx.cs, things were
very crude. I was just registering a callback to fire every once in a while,
sending some data.  I hadn't set up any way for the server to actually do a
notification. All it did was take some page data and send the data very slowly
without tying up a thread in the meantime.  I think that I had hundreds of 
requests pending when testing this out.

The second attempt was using the threadpool instead of using the implicit
async page attributes on the aspx page. This way I should be able to control
things better, and not have to keep registering a new callback in the callback
handler, basically 'trampolining' things.

I tried this out under mono and Microsoft both. Under IIS and under xsp2 
web server under mono.  I know that both worked, but I don't think that we 
get the benefit of socket pooling under linux.

- dan 11/24/2009

comet-server-for-asp.net's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.