-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Proxy performance fix #3440
Proxy performance fix #3440
Conversation
Please follow the PR template - most importantly, add a separate commit with a relicensing grant: https://github.com/zeromq/libzmq/blob/master/.github/PULL_REQUEST_TEMPLATE.md |
perf/proxy_thr.cpp
Outdated
#if defined ZMQ_HAVE_WINDOWS | ||
(void) buffer; // unsupported | ||
#else | ||
pthread_setname_np (pthread_self (), buffer); |
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.
setname is not posix, please remove all this thread name changing as it breaks the build on !Linux
perf/proxy_thr.cpp
Outdated
if (str_) { | ||
if (len != strnlen (buffer, sizeof (buffer))) { | ||
printf ( | ||
"invalid response string length: expected %zu, received %zu", len, |
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.
../perf/proxy_thr.cpp:123:78: error: ISO C++ does not support the ‘z’ gnu_printf length modifier [-Werror=format]
Please don't add fixup commits, squash it into the original, or it will break bisecting. Then force push |
perf/proxy_thr.cpp
Outdated
|
||
void recv_string_expect_success (void *socket_, const char *str_, int flags_) | ||
{ | ||
const unsigned long len = str_ ? strlen (str_) : 0; |
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.
@emtr breaks the build on windows:
C:\projects\libzmq\perf\proxy_thr.cpp(110): warning C4267: 'initializing' : conversion from 'size_t' to 'const unsigned long', possible loss of data [C:\projects\build_libzmq\proxy_thr.vcxproj]
perf/proxy_thr.cpp
Outdated
if (len != strnlen (buffer, sizeof (buffer))) { | ||
printf ( | ||
"invalid response string length: expected %lu, received %lu", len, | ||
strnlen (buffer, sizeof (buffer))); |
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.
@emtr breaks the build with clang:
perf/proxy_thr.cpp:130:48: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Werror=format=]
strnlen (buffer, sizeof (buffer)));
Improve performance of the proxy forwarding batch of message. Add throughput benchmark for proxy. Fix valgrind error reported on unitialized vars RELICENSE: Add emtr grant
6cda0a8
to
d41ed61
Compare
Fixed issues (broken builds, formatting); squashed commits |
thanks! |
Thanks |
As suggested by user somdoron on zeromq-dev mailing list, I implemented the zmq_recv with DONT_WAIT and a benchmark for proxy throughput.
The benchmark shows an important increase of forwarding performance, on my system from ~290kpps to >3Mpps.
Moreover the amount of calls to syscall poll is much lower:
After: