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

[WIP, RFC] Problem: lot of use of dynamic memory allocation, leading to performance degradation and non-determism #3911

Draft
wants to merge 58 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4f84758
Implement a very simple zero-lock message pool to test performance gains
f18m Aug 13, 2019
ea0dc06
Merge branch 'master' of https://github.com/f18m/libzmq.git
f18m Aug 13, 2019
a24f2af
Allow to choose message sizes as well
f18m Aug 13, 2019
1bd2ae1
Allow using env variables to do some basic overriding
f18m Aug 13, 2019
252e8d4
fix typo
f18m Aug 13, 2019
4a30795
add TCP kernel socket buffer setting
f18m Aug 13, 2019
577232e
Merge remote-tracking branch 'upstream/master'
f18m Aug 25, 2019
ff8d79f
Merge remote-tracking branch 'upstream/master'
f18m Aug 28, 2019
00e514e
First implementation of global memory pool for ZMQ
f18m Aug 28, 2019
18c52c4
Remove changes related to graph generation
f18m Aug 28, 2019
a720a31
allow testing up to 8k msg sizes
f18m Aug 28, 2019
b9e1f01
correctly deallocate memory pool blocks
f18m Aug 30, 2019
1649701
fix build with no draft API
f18m Aug 30, 2019
0baafa4
never use allocator for VSM
f18m Aug 31, 2019
59cbfac
Merge branch 'master' of https://github.com/zeromq/libzmq into memory…
May 2, 2020
f0a7a7f
Fixes cmake build
May 2, 2020
f682600
Changes to base class with virtuals
May 2, 2020
3a3d877
Makes max message size dynamic
May 2, 2020
b416348
Dynamically grows mempool
May 2, 2020
cfd4c85
Updates dynamic global pool
May 3, 2020
1dd2304
Removes unnecessary class
May 3, 2020
d06f868
Adds new files to makefile
May 4, 2020
cfa228b
Adds concurrentqueue to sources
May 4, 2020
d96d616
Fixes some warnings
May 4, 2020
caf7798
Adds includes
May 4, 2020
5fbc4cc
Makes initial number of messages a bit more dynamic
May 5, 2020
d2c53c5
Hides global allocator implementation and option when C++11 not avail…
May 5, 2020
348865f
Fixes msvc __cplusplus reporting
May 5, 2020
59c6a6c
Improves <C++11 support
May 5, 2020
1f5abc1
Fixes missing declaration
May 5, 2020
2c29abc
Adds more c++11 guards
May 5, 2020
d7f9452
Adds test and moves queue to external
May 12, 2020
1450beb
Merge branch 'master' of https://github.com/zeromq/libzmq into memory…
May 12, 2020
f4973dc
Fixes bad path
May 12, 2020
3b9ec2f
Fixes bad path
May 12, 2020
a260668
Fixes formatting
May 12, 2020
7dafdf7
Adds destroy to test
May 13, 2020
a3bfc67
Fixes wrong increment
May 13, 2020
cd90418
Fixes bad c+11
May 13, 2020
a575335
Adds a basic concurrent queue
May 13, 2020
74dd371
Removes some debug code
May 13, 2020
e9c3a01
Adds newline and nullptr
May 13, 2020
aaa10dd
Adds a start on function pointer interface
May 13, 2020
77293ab
Adds missing free
May 13, 2020
1309316
Cleans up some includes
May 16, 2020
d666af8
Fixes bad options
May 16, 2020
73807f8
Moves to draft
May 16, 2020
ffcede1
Fixes formatting
May 16, 2020
312f8c3
Updates copyright years
May 16, 2020
bf495f8
Switches to new/delete
May 16, 2020
61870a4
Switches to alternative log2
May 16, 2020
c13f837
More copyright years
May 16, 2020
ea9c5dc
Fixes more formatting
May 16, 2020
20f49ec
Fixes more bad years
May 16, 2020
ba05e8f
Fixes some concurrency issues and bugs
May 17, 2020
afb858d
Merge branch 'master' into memorypool
Sep 19, 2020
32d827d
Adds destroy fn
Sep 19, 2020
84b4f8f
Adds destroy
Jan 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ endif()
# Select curve encryption library, defaults to tweetnacl To use libsodium instead, use --with-libsodium(must be
# installed) To disable curve, use --disable-curve

option(WITH_LIBSODIUM "Use libsodium instead of built-in tweetnacl" ON)
option(WITH_LIBSODIUM "Use libsodium instead of built-in tweetnacl" OFF)
mjvankampen marked this conversation as resolved.
Show resolved Hide resolved
option(WITH_LIBSODIUM_STATIC "Use static libsodium library" OFF)
option(ENABLE_CURVE "Enable CURVE security" ON)
option(ENABLE_CURVE "Enable CURVE security" OFF)

if(ENABLE_CURVE)
if(WITH_LIBSODIUM)
Expand Down Expand Up @@ -571,6 +571,8 @@ if(MSVC)

zmq_check_cxx_flag_prepend("/analyze")

zmq_check_cxx_flag_prepend("/Zc:__cplusplus") # enables right reporting of __cplusplus, ref. https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/

# C++11/14/17-specific, but maybe possible via conditional defines
zmq_check_cxx_flag_prepend("/wd26440") # Function '...' can be declared 'noexcept'
zmq_check_cxx_flag_prepend("/wd26432") # If you define or delete any default operation in the type '...', define or
Expand Down Expand Up @@ -849,6 +851,8 @@ endif()
set(cxx-sources
precompiled.cpp
address.cpp
allocator_default.cpp
allocator_global_pool.cpp
channel.cpp
client.cpp
clock.cpp
Expand Down Expand Up @@ -949,9 +953,12 @@ set(cxx-sources
zmtp_engine.cpp
# at least for VS, the header files must also be listed
address.hpp
allocator_default.hpp
allocator_global_pool.cpp
array.hpp
atomic_counter.hpp
atomic_ptr.hpp
basic_concurrent_queue.hpp
blob.hpp
channel.hpp
client.hpp
Expand Down Expand Up @@ -1091,6 +1098,8 @@ set(cxx-sources
zap_client.hpp
zmtp_engine.hpp)

list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/mpmcqueue/concurrentqueue.h)

if(MINGW)
# Generate the right type when using -m32 or -m64
macro(set_rc_arch rc_target)
Expand Down Expand Up @@ -1219,7 +1228,7 @@ if(ZMQ_BUILD_FRAMEWORK)
COMMENT "Perf tools")
endif()

option(ENABLE_PRECOMPILED "Enable precompiled headers, if possible" ON)
option(ENABLE_PRECOMPILED "Enable precompiled headers, if possible" OFF)
if(MSVC AND ENABLE_PRECOMPILED)
# default for all sources is to use precompiled headers
foreach(source ${sources})
Expand Down
6 changes: 6 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ include_HEADERS = \
include/zmq_utils.h

src_libzmq_la_SOURCES = \
external/mpmcqueue/concurrentqueue.h \
src/address.cpp \
src/address.hpp \
src/allocator_default.cpp \
src/allocator_default.hpp \
src/allocator_global_pool.cpp \
src/allocator_global_pool.hpp \
src/array.hpp \
src/atomic_counter.hpp \
src/atomic_ptr.hpp \
src/basic_concurrent_queue.hpp \
src/blob.hpp \
src/channel.cpp \
src/channel.hpp \
Expand Down
Loading