-
Notifications
You must be signed in to change notification settings - Fork 21
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
Need help with weave as background process #155
Comments
That's interesting. I'll looked into it. |
* Add more sanity checks * workaround #155
I've merged a fix in #157 You also need to update your code according to https://github.com/mratsim/GuildenStern/pull/1/commits/a1e22d4798a7475c25d3c0a6051c4aca43d3c647
Besides the fix, I think I'll need to design some specific multithreading scheme for IO needs like HTTP servers. Does Guildenstern reaches the same perf as HttpBeast when they are both single-threaded? |
Thank you!, I've implemented the fix.
It is too much to require -d:danger switch to be always on; the code must work in other modes, too. On designing an I/O specific mutlithreading scheme, see my comment at: "HTTP server" is too broadly defined I/O problem, especially because all Nim servers (AsyncHTTPServer, Guildenstern, HTTPBeast...) are written with the expectation that they are run behind a true HTTP (reverse proxy) server such as Nginx or Caddyserver which takes care of the real I/O problems of open Internet containing malicious adversarial I/O devices. However, here are some benchmark results. As I see it, minimizing worst-case latency is more important than throughput ;-) Guildenstern with Weave, 4 threads: Guildenstern, single-threaded: httpbeast, single-threaded: httpbeast, 4 threads: |
The assert shouldn't be triggered unless there is are spawn or parallel loop left, I'll checkout your fixes. Mmmh it's good to know that the base single-threaded server is fast enough. I'm reopening this #22 for IO research. I fear that while playing well with async is relatively easy (and done), having multithreading optimized for IO requires a completely different design, one of those would be more akin to Tokio in Rust. I.e. I need to have distributing waiting at the selector level (not familiar with low-level async IO yet so may be inaccurate). |
I have refactored Guildenstern so that http event listener (selector) and Weave background process are now in different threads. When event comes in, it is submitted to Weave and then instantly spawned. Everything works as long as there's a sleep(10) command after submitting, otherwise Weave crashes as if I'm submitting events faster that it can process them.
The sleep line and the error message without it are here:
https://github.com/olliNiinivaara/GuildenStern/blob/1b1dfab9b3529eb45cce0e35df16c891b1a394f2/src/guildenstern/dispatcher.nim#L133
Clearly there's something wrong, but what?
The text was updated successfully, but these errors were encountered: