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

Improve zmq setup #726

Open
Debilski opened this issue Jul 27, 2021 · 0 comments
Open

Improve zmq setup #726

Debilski opened this issue Jul 27, 2021 · 0 comments
Assignees
Labels

Comments

@Debilski
Copy link
Member

As per this answer here https://stackoverflow.com/a/44280419 it is suggested to use the following best-practice setup for zmq:

import zmq
nIOthreads = 2                           # ____POLICY: set 2+: { 0: non-blocking, 1: blocking, 2: ...,  }
context = zmq.Context( nIOthreads )      # ____POLICY: set several IO-datapumps

socket  = context.socket( zmq.PAIR )
socket.setsockopt( zmq.LINGER,      0 )  # ____POLICY: set upon instantiations
socket.setsockopt( zmq.AFFINITY,    1 )  # ____POLICY: map upon IO-type thread
socket.setsockopt( zmq.RCVTIMEO, 2000 )

socket.connect( "ipc:///tmp/something" )
socket.send( b"123" )
try:
    message = socket.recv()
except:
    print( "DEBUG!" )
    message = None
finally:
    socket.close()                       # ____POLICY: graceful termination
    context.term()                       # ____POLICY: graceful termination

We should try to understand these settings and see if we can implement them for all our sockets. (Currently only implemented for one particular socket in #725).

@Debilski Debilski added this to the Post-ASPP-2021 milestone Jul 27, 2021
@Debilski Debilski self-assigned this Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant