message_bus
message_bus copied to clipboard
Unknown delay when delivering chunked messages
When using long polling I discovered there is a significant delay when message is written to client's IO
https://github.com/discourse/message_bus/blob/12dd450c213cc4332a157b960cf77730c18078b7/lib/message_bus/connection_manager.rb#L34-L36
and when the message is sent through the network. It varies but usually within the range 300-1000ms.
ActionController::Live in comparison sends data as soon as it is written (0ms delay)
Do you have any clues where that delay might come from?
I tried locally with Rails development and production mode on MacOS.
Tested on heroku, seems like it's not the case there. At least the range is much smaller.
When compared to ActionCable implementation, MessageBus has additional 50ms delay