Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made websocketsd more efficient #57

Merged
merged 2 commits into from
Apr 28, 2015
Merged

Made websocketsd more efficient #57

merged 2 commits into from
Apr 28, 2015

Conversation

kkleidal
Copy link
Contributor

@kkleidal kkleidal commented Apr 6, 2015

implemented select loop for non-blocking reading from ZMQ sockets
blocks read on all WS sockets (XXX: uses many threads; find better ws library that allows select loops)
Uses one ZMQ socket per tag rather than one ZMQ socket per WS connection

This is a possible step on the way to fixing #51 , but since I haven't replicated the bug presented in #51, it still needs to be tested in practice. And there is still room for improvements.

blocks read on all WS sockets (XXX: uses many threads; find better ws library that allows select loops)
Uses one ZMQ socket per tag rather than one ZMQ socket per WS connection
try:
ws.send(msg)
# Read from ws socket continuously.
# XXX: This builds up a lot of threads. Is there ANY way we could do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually spawn system threads, or do you mean greenlets? As I understand it flask-sockets is based on gevent-websocket, which should spawn a greenlet per connection (which will be "green-blocked" on ws.receive()) Under the hood I'd expect it do be doing something like select

@ssfrr ssfrr merged commit 3d21590 into ResEnv:master Apr 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants