-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat(server): spawn task sooner in listenloop #1102
base: master
Are you sure you want to change the base?
Conversation
f804214
to
fd18b80
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1102 +/- ##
==========================================
- Coverage 82.71% 82.57% -0.14%
==========================================
Files 32 32
Lines 3054 3065 +11
==========================================
+ Hits 2526 2531 +5
- Misses 528 534 +6 ☔ View full report in Codecov by Sentry. |
Seeing old PRs it may be either that |
Yes, i think that's it. And i think we rely on that in our internal Server code (at RAI)... i see this comment in some internal server code # HTTP.serve! uses `@async` under the hood. Because of `@async` and because there are no
# yield points during server state manipulation, we can modify the server state within
# `handle_*` methods without having to worry about thread safety, like we would if
# HTTP.serve! used `@spawn` to handle requests. Actual work is done in the `@spawn`ed
# tasks which **don't** access the `Server`. |
Makes sense. I think the spirit of this PR doesn't need |
I'm not sure how to fix the invalidations :(
|
Sorry for the confusion, I just missed an |
Benchmarked it on a simple hello world endpoint with before
after
|
To clarify, we're still in favour of changing At RAI we currently have some code that is written based on the assumption HTTP is using |
UsesThreads.@spawn
instead of@async
in listenloopconns
dict lockable because that's also not thread safe in itself if I understand correctly.(this work has a lot of ideas and snippets from @tanmaykm 🙏🏽)