I know about projects like Edge.js which allow for C# and Node.js connectivity, but I'm talking about something different. Is there a library for C#, that allows you to build scalable, non-blocking I/O, single threaded, async event servers in C#, similar to the servers you can build with Node.js? A library that also has the unique event model of Node.js, single threaded for user code, multi threaded for file/network events and native code (correct me if I'm wrong). Of course I know about ASP and WCF, and OSS projects like this, but I'm looking for something that gives you performance comparable to Node.js, a kind of Node.js port to C#. Do you know of any such library, and what would it take to build it?
Single threaded or multi threaded?
If you want a single threaded managed process that does all its work using APC and completion ports, you are going to have to hand code it. Building it would be risky and tricky. -- Sam Salton
Obivously, being single threaded makes code easier to write since you don't need to work with locks and mutexes. There's just one thread reading/modifying program state data which keeps things simple. All calculations occur on seperate threads and return to the main thread when the results are ready. All file/network events branch out and return to the main thread after the op is complete.
Related but different questions:
Probably useful projects:
- ALE comes the closest to what I want, syntax similar to Node.js
- Manos de mono, a single threaded server for C#
- A message loop in C#, that processes events on a single thread
- Wrappers for Libuv in C# (1, 2)
- Anna for HTTP requests only (no binary), syntax similar to Node.js