-
Notifications
You must be signed in to change notification settings - Fork 0
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
Multithreaded fan #21
Conversation
635142a
to
772e0e6
Compare
Rebased on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few magic numbers (8, 100 and 10000) which are used in multiple places so perhaps they should at least be #defined somewhere.
I've been looking into some of the magic numbers and whether they can be taken from any of the following eigerfan command line options:
The number of sockets option is currently not used in the code I believe the place where it should be used is when setting up the zmq context as part of EigerFan constructor.
This context has a second optional argument of number of sockets which is never specified
so must always default to the zmq default of 1023
(https://github.com/zeromq/libzmq/blob/master/include/zmq.h)? The number of threads option is only used once, in the constructor where config is passed as an argument
I'm wondering whether the number of threads given to the MultiPullBroker (currently hard-coded values) should match the number of zmq threads, or whether it should be treated completely independently (ie given its own argument or #define)? Finally, there is an additional zmq context created with HandleRxSocket which is spawned by the run function. Should this take the same number of threads as the EigerFan zmq contexts, or should it also be treated independently? |
I am surprised that the command line sockets not used, but, if it doesn't do anything currently I think we should use it to pass into the broker constructor and leave ZMQ context sockets as the default.
I don't think there is any particular reason that it should be the same, but it is probably more reasonable than hard-coding one while the other is configurable. |
Do you mean the broker constructor? This only has an argument for number of threads (rather than sockets)?
I think that's reasonable if we update the wording to say "the number of threads used for all zmq contexts". Alternatively a new command line option can be provided for this one thing, but it would probably always be the same value anyway |
Well the two are effectively equivalent, but perhaps it would better to have -t / --threads (passed to MultiPullBroker) and -z / --zmq-context-threads (passed to zmq context). |
I'm sure that command line was used at some point! Maybe when I was playing around at the beginning with optimising performance? But can't remember now sorry |
* Repurpose now unused sockets as contextthreads * Pass broker cmd line threads or the default * Give HandleRxSocket an extra argument so can use context_threads * Add hypen to variable for easier reading * Clearer option description * Remove duplicate EigerFan.h reference * Rename num_zmq_threads to num_threads
I think the remaining issues are the magic numbers for high water mark and socket linger timeout I propose #defines for these? Does that sound ok? |
* Removing redundunt lines. hwm is being set by RECEIVE_HWM * Use SEND_HWM instead of local hwm * Introduce LINGER_TIMEOUT constant, replace local linger variables * Use a different, lower HWM for the worker threads
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good now.
@ndevenish if you have some time to have take a look at this that would be great, but otherwise I think we are just about ready to merge, @JamesOHeaDLS.
Hi @GDYendell
I04 have been using this multithreaded-fan branch for the past week, and it has been running fine, no problems
Hopefully this branch can be merged in to master.
There is a question over where the number of threads is set, and what value it is currently set to?
Thanks,
James