SignalR lost messages if IIS configure with more t

2019-01-26 12:41发布

I broadcast and receive all messages with 1 worker process IIS. Bump the worker process to 2, I receive only every other messages (lost 50%). Is it by designed, configuration or bug?

标签: signalr
1条回答
虎瘦雄心在
2楼-- · 2019-01-26 13:02

This is by design. The two worker processes don't share state and clients will be distributed between them on a round-robin basis, which means 50% will connect to process A and 50% to process B. As the underlying SignalR message bus is in-memory by default, process A doesn't see messages from process B.

What you're configuring is called a "web garden" (not to be confused with "web farm") and is commonly used to make faulty applications more responsive (see this SO question). As SignalR is built from the ground up with scalability in mind, this configuration won't give you any benefit.

My recommendation is to keep the worker process limit at 1.

There is however a way to make it working with web gardens: you'd need to use an external message bus like Redis or Windows Azure Service Bus (details can be found in the docs) for sharing messages between the processes, which of course introduces additional network latency.

查看更多
登录 后发表回答