Hi Gerry
Start with simple experiments, then characterize them.
Answer these questions:
- What is your biggest unknown?
- What is the cheapest experiment you can do to better understand that unknown?
- How can you characterize that experiment and its results?
Then, repeat.
For example, I think your biggest unkown is speed.
Speed of what?
Simple experiment - how fast can you pull characters out of SQLite?
Simple experiment - how fast can you push characters down the throat of the link?
Simple experiment(s) - increase the buffer size from single characters to ??? (1K, 100K, 1M, 1G)
Simple experiment - which operating systems / languages / products let you get at SMP?
Simple question - will you need MMAP? What will make this less painful?
Simple characterization (for speed-related unknowns) : profiling.
Simple question - build vs. buy. What can you buy in (from, say, github) that will help you? What do you need to control (i.e. build yourself, instead of githubbing)?
My gut says that using C instead of Lisp won't buy you nearly as much as getting rid of the operating system (and SQLite?).
When I needed bare-metal speeds, I wrote device drivers. I used Harel Statecharts to avoid spaghetti code.[1]
Simple question - can you find any ethernet stacks written on top of any operating system? Are such stacks written only at the device driver level? How does your problem compare to ethernet speeds?
Green threads are closure wannabes. (Greenspun's 10th Rule).
Red threads are green-thread wannabes, with the added complication of Time-Sharing (full preemption). Time-sharing is the reason that multi-tasking has a bad name. AFAIK, Erlang is based on the Time-sharing paradigm (using call-counting, instead of timer interrupts).
Simple question - can you get away with using Bordeaux Threads? It's just an abstraction, a union of what is available in various implementations. Create an experiment. Can you get away with using any Actors libraries?
Other places to look: Doug Hoyte's "Anti-Web". A web server that doesn't use O/S threads, AFAIK.
pt
[1] Threads/Processes are state machines. State is scurried away on the stacks. Separate stacks for processes are overheads. O/S'es hide these overheads from you. Separate stacks are OO. OO is a skin on closures. OO targets data only, and screws up control-flow. The worst problem in Software is Design Intent and Structure (aka "Architecture"). Speed problems have tools (profilers). Spaghetti Architectures do not have tools, AFAIK. HLLs are the best that we have. And self-discipline.