-
Notifications
You must be signed in to change notification settings - Fork 161
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
Single-Threaded Service #592
base: beta
Are you sure you want to change the base?
Conversation
This is a question for @skitt :) Can you please tell us if this would be problematic for the ubuntu package?
Multithreading in python is a bit special apparently. GIL prevents the usage of more than one core. So while multithreading helps to make things concurrent when threads are waiting for i/o, it does not improve performance. I wonder what the benefits of multithreading over asyncio are. |
I think it would make sense to release 2.0 before we merge this |
Sounds like good benefits |
I think so as well
From what I know there are no benefits to multithreading over asyncio. With mutlithreading we don't know where the execution is interrupted and another thread runs. So it is involuntary or implicit concurrency. With aio we know that other coroutines can only run when the execution is |
From a packaging perspective dbus-next will be available in Debian 12 and is available in Ubuntu 22.10 (imported from Debian). So the distro packages will be OK, but the package provided on GitHub will be usable on a limited selection of releases. |
Thank you! |
This runs the Service in a single process.
It should reduce overhead (only one python interpreter running) and it allows for better Profiling. In addition it allows us to simplify the injector, shared-dict and test-fixtures because we can remove all the communication stuff.
There is one issue with this: the use of a different dbus library dbus-next. This is needed because the current library pydbus needs a GLib.MainLoop, which is incompatible with asyncio. There is a merge-request to add a asyncio compatible GLib.MainLoop, but who knows when this is ready.
Unfortunately dbus-next is not part of the Ubuntu repos.
An alternative could be dbussy but that deliberately introduces inconsistency with method return types (see this issue).
There is also jeepney, but that is missing a high level interface, so it will require extra work.
Both of these alternatives are part of the ubuntu repos. But I still think that dbus-next offers the best interface with only one issue for which I found a workaround.
So the question is: