Skip to content
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

Consider using asyncioreactor #8642

Open
matrixbot opened this issue Dec 18, 2023 · 0 comments
Open

Consider using asyncioreactor #8642

matrixbot opened this issue Dec 18, 2023 · 0 comments

Comments

@matrixbot
Copy link
Collaborator

matrixbot commented Dec 18, 2023

This issue has been migrated from #8642.


Idea

Use twisted.internet.asyncioreactor for synapse's twisted reactor.

Description

This is part of my idea that synapse should consider moving forward, beyond, or at least next to twisted, to also use asyncio's economy of libraries and functions. With the asyncioreactor, it's possible to mix twisted and asyncio functionality with eachother.

It's also possible to use uvloop in addition to this, allowing a big IO performance boost.

Some links:

asyncioreactor: https://twistedmatrix.com/documents/current/api/twisted.internet.asyncioreactor.html

asyncio/twisted intermixing: https://gist.github.com/ldjebran/4febf298232a6fd86871df25d4dc00dd

Deferred.asFuture(): https://twistedmatrix.com/documents/current/api/twisted.internet.defer.Deferred.html#asFuture

Twisted and Asyncio (blog post): https://meejah.ca/blog/python3-twisted-and-asyncio

Considerations

I have two concerns with doing this:

  1. Will the existing twisted-based code be stable on a new reactor based out of asyncio?

  2. Will the reactor impact performance (negatively)?

For 1, I want to run a server along my existing one, only joining some channels, and watch out for any crashes and the like, and/or perform test benches with asyncioreactor selected.

For 2, I'd want to know what the best way is for me to collect such statistics and/or how to compare them with a normal server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant