Skip to content

Heartbeat and starvation #71

@ghost

Description

Hi all,

I am using tornadio2 from the GIT repository, b463209

I recently dicovered a problem in the way heartbeats are handled by Tornadio.

Incoming messages go through the on_message method of the TornadioWebSocketHandler class (in persistent.py). This entry point is used both by Socket.IO events and heartbeat frames. If the connection gets suddenly flooded —in a perfectly valid use-case—, Tornadio doesn't process the heartbeat frames anymore, because they are queued far behind all the other messages.

I implemented my server using a top-half / bottom-half pattern, but it is not enough, and the connection keeps getting closed although everything is working fine.

I have one solution, but you must know I am no Python expert. :)

Tornadio should first read messages as fast as possible to immediately read heartbeat frames. Event processing can be delayed to another worker. Basically, this is implementing the top-half / bottom-half logic in Tornadio itself.

What do you think? There might be a better idea. I am willing to help if needed.

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions