SignalR MaximumParallelInvocationsPerClient only run on one thread #54835
Replies: 1 comment
-
Let's continue in #54836 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm currently using one HubConnection to execute multiple tasks on a hub. I've configured MaximumParallelInvocationsPerClient = 4 in the hub settings. It seems that when tasks complete quickly, they run concurrently. However, if there is a long-running task, it blocks other tasks from running.
To investigate this issue, I logged the thread IDs and found that all tasks from one connection use the same thread. Therefore, when a long-running task occurs, it blocks other tasks.
I utilized Thread.Sleep to simulate a long-running task.
As observed in the provided screenshot, all tasks are executed on the same thread. Consequently, when a long-running task occurs, it causes other tasks to be blocked.
To address this issue, I used Task.Run to execute my long-running task in the background, and everything worked fine.
However, I'm wondering if there is a configuration option to run concurrent tasks from one connection in multiple threads
And is the MaximumParallelInvocationsPerClient only allow each client call multiple hub method at same time but in the same thread?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions