Subscriptions Performance #2961
Unanswered
AlexanderWells-diamond
asked this question in
Q&A
Replies: 1 comment 4 replies
-
hi @AlexanderWells-diamond 😊 would you be possible for you to write a benchmark that we can use to monitor this? We also some updates on subscription, but I don't know if they will make things worse or better. I'm personally very interested in improving the performance, but I haven't had time to do much on that. I'm sure we can make the Strawberry part faster, but I'm not 100% sure if we can do the same for GraphQL-core, at least not easily |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been profiling a Strawberry server, and unfortunately it seems to perform less than adequately for my use. Is anyone able to offer any insights as to why it appears to be slow?
The test I'm seeing the problems with sets up a server, then a separate Python client that creates many subscriptions. Each subscription is to a process that in effect is just counting upwards at 10Hz. Knowing this, each client subscription can spot when updates have been missed. The issue I see comes at above 100 concurrent subscriptions. Everything seems stable up to that point, but above that I see a lot of dropped updates - this correlates to the point at which the single-threaded Python process hits 100% CPU usage.
I've attached a speedscope recording file here (it isn't a .txt, GitHub just made me name it that). From my understanding this shows that the program is spending at least 70% of its time inside Strawberry code, or its dependants:
operation_task
at/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py:274
await_result
at/graphql/execution/execute.py:528
await_result
at/graphql/execution/execute.py:527
await_result
at/graphql/execution/execute.py:531
await_completed
at/graphql/execution/execute.py:547
And I only see 8.0% of time in my subscription handler (
coniql/src/coniql/strawberry_schema.py:184
). This leads me to believe the vast majority of the time is being spent receiving/formatting/sending the GraphQL messages. I struggle to believe this though, as it would imply that Strawberry can only support ~1000 updates a second. This seems very low, so I'm hoping that I'm missing something!Thank you for any input.
Beta Was this translation helpful? Give feedback.
All reactions