-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove background thread #98
Conversation
I did have a go testing a Rest API + IOC (mutli transport FastCS device) in a multi-threaded implementation (https://github.com/DiamondLightSource/FastCS/tree/multi-trans-threaded) vs a single event loop - against a serial device with a single client: Single eventloop:
Multithreaded:
I ran the tests a few times and they are consistent, on my machine. It seems that the multithreaded approach does add significant tail latency to "ca clients" which supports the approach in this PR Also, I found no significant difference for a single client when adding additional transports |
I haven't looked at the changes yet, but nice work with the benchmarking, that is really useful. |
Still needs some work. Im not sure I see this as becoming part of the test suite but it might be useful in dev or to track drift |
44b5eb5
to
0a43cfd
Compare
4cee203
to
f005662
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
==========================================
- Coverage 88.08% 87.77% -0.32%
==========================================
Files 31 31
Lines 1309 1341 +32
==========================================
+ Hits 1153 1177 +24
- Misses 156 164 +8 ☔ View full report in Codecov by Sentry. |
f005662
to
2277ce6
Compare
Here are the latest benchmarks (running EPICS + REST + Tango together):
I believe Tango suffers under loading since we are having to run it in a separate thread as it wont take a running event loop |
@GDYendell ready |
@marcelldls there is a conflict after the other merges. |
1e36990
to
b901305
Compare
@GDYendell Looking a bit neater now? |
Currently the
backend
creates a background thread andrun_coroutine_threadsafe
is used as the mechanism to schedule work in this background eventloop.Moving to a single eventloop has the following benefits:
An error occurred: <asyncio.locks.Lock object at 0x7fa65fa5e450 [locked]> is bound to a different event loop
which can occur on put requeststransports
simultanously from a single threadtransports
To solve:
@GDYendell Creating a draft in-case this needs to be picked up but also for some thoughts?