Description
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:
-
Will the existing twisted-based code be stable on a new reactor based out of
asyncio
? -
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.