azure-signalr
azure-signalr copied to clipboard
Improve the message write logic from SDK to service
Current issues
- Messages sending from server to service are pinned to fixed connections
- Messages sending from server to service does not support partial send
- Messages sending is coupled with the underlying websocket connection, when the websocket connection dies, messages in the pipe will fail to send out
- The current
WriteAsyncimplementation of ServiceConnectionBase, usesSemaphoreSlimto lock the write, concurrent writes wait to acquire the lock https://github.com/Azure/azure-signalr/issues/660. It can misorder the messages and make dump/debug the memory not easy
Some improvements to discuss/implement
- [x] 1. Remove unnecessary
SemaphoreSlimusage to reduce lock (Fixed in #672) - [ ] 2. Use random server connections instead of pinning to fixed server connections when sending messages back to service
- [ ] 3. Split large messages into smaller pieces when sending messages back to service
- [ ] 4. Replace
SemaphoreSlimwith a queue so that it is more straight forward how many messages are queued