-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A new server archtecture #127
Comments
|
I think in principle this makes sense. As you already point out, having threads per stream avoids the deadlock that we ran into in kazu-yamamoto/network-control#4 . Indeed, in The devil is always in the detail of course; some rethinking of the architecture might be useful, but without actually thinking it through completely it's hard for me to really say whether this will be an overall improvement or not. That being said, I think if the goal is simplification of the model, and making the code easier to understand, I'm all for it; if the goal is merely to reduce the number of threads, then I'm less convinced that it's terribly useful; threads in Haskell are cheap enough. Indeed, the number of concurrent streams is significantly higher than the number of workers currently employed by (*) Caveat: this is actually only true for non-streaming bodies; |
Done via #130. |
GHC 9.6 provides
listThreads
finally.Watching the number of threads in
http2
usinglistThreads
revealed that a lot of threads are instantly spawn due toforkAndEnqueueWhenReady
.One waits for
TBQ
and the other waits for stream window.To reduce the number of threads, I would like to propose another architecture for servers.
Stop using the worker pool model.
Rather, one thread is spawn for each stream.
The number of threads follows
maxConcurrentStreams
.Each designated thread feeds an output chunk to the output queue from a file or streaming data repeatedly.
I guess that the complicated
DynaNext
is not necessary anymore.This should drastically simplify
Sender
.That is,
Sender
just packs output chunks from the output queue.Stream window should be taken care by each designated thread.
Connection window should be taken care by
Sender
.@edsko @FinleyMcIlwaine What do you think?
The text was updated successfully, but these errors were encountered: