azure-signalr icon indicating copy to clipboard operation
azure-signalr copied to clipboard

Improve the message write logic from SDK to service

Open vicancy opened this issue 6 years ago • 0 comments

Current issues

  1. Messages sending from server to service are pinned to fixed connections
  2. Messages sending from server to service does not support partial send
  3. Messages sending is coupled with the underlying websocket connection, when the websocket connection dies, messages in the pipe will fail to send out
  4. The current WriteAsync implementation of ServiceConnectionBase, uses SemaphoreSlim to 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 SemaphoreSlim usage 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 SemaphoreSlim with a queue so that it is more straight forward how many messages are queued

vicancy avatar Oct 24 '19 07:10 vicancy