Affinity Problem using Multiprocessing
sinwoobang opened this issue · comments
You can refer to an issue that I opened on hypercorn
.
I encountered a problem that multiprocessing servers powered by aioquic
are impossible to handle INITIAL Packet.
Even though I found an INITIAL packet log, following packets were connected to another process and the aioquic
library raised an error.
AssertionError: first packet must be INITIAL
Do you find aioquic
responsible for handling this issue? Otherwise, should a sorta extension deal with it?
Thanks
Hi,
Multithreading or multiprocessing with QUIC is generally problematic because the threads or processes read packets from a UDP socket randomly. There is no mapping between a single QUIC connection and a single thread/process. On Linux or FreeBSD, it's possible to use SO_REUSEPORT(_LB), which allows for deterministic distribution of the packets. Unfortunately, it doesn't help with connection migration.
I think this is an integration issue on the hypercorn
side. aioquic
just provides building blocks, and this multi-process architecture is up to the library user.