Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
fca45921
Commit
fca45921
authored
May 03, 2016
by
somdoron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
problem: zeromq performance got worsen by some changes
parent
115e7de7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
17 deletions
+22
-17
config.hpp
src/config.hpp
+6
-0
options.cpp
src/options.cpp
+4
-4
stream_engine.cpp
src/stream_engine.cpp
+12
-13
No files found.
src/config.hpp
View file @
fca45921
...
...
@@ -59,6 +59,12 @@ namespace zmq
// unnecessary network stack traversals.
in_batch_size
=
8192
,
// Maximal batching size for engines with sending functionality.
// So, if there are 10 messages that fit into the batch size, all of
// them may be written by a single 'send' system call, thus avoiding
// unnecessary network stack traversals.
out_batch_size
=
8192
,
// Maximal delta between high and low watermark.
max_wm_delta
=
1024
,
...
...
src/options.cpp
View file @
fca45921
...
...
@@ -43,8 +43,8 @@ zmq::options_t::options_t () :
recovery_ivl
(
10000
),
multicast_hops
(
1
),
multicast_maxtpdu
(
1500
),
sndbuf
(
8192
),
rcvbuf
(
8192
),
sndbuf
(
-
1
),
rcvbuf
(
-
1
),
tos
(
0
),
type
(
-
1
),
linger
(
-
1
),
...
...
@@ -146,14 +146,14 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
break
;
case
ZMQ_SNDBUF
:
if
(
is_int
&&
value
>=
0
)
{
if
(
is_int
&&
value
>=
-
1
)
{
sndbuf
=
value
;
return
0
;
}
break
;
case
ZMQ_RCVBUF
:
if
(
is_int
&&
value
>=
0
)
{
if
(
is_int
&&
value
>=
-
1
)
{
rcvbuf
=
value
;
return
0
;
}
...
...
src/stream_engine.cpp
View file @
fca45921
...
...
@@ -192,10 +192,10 @@ void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
if
(
options
.
raw_socket
)
{
// no handshaking for raw sock, instantiate raw encoder and decoders
encoder
=
new
(
std
::
nothrow
)
raw_encoder_t
(
o
ptions
.
sndbuf
);
encoder
=
new
(
std
::
nothrow
)
raw_encoder_t
(
o
ut_batch_size
);
alloc_assert
(
encoder
);
decoder
=
new
(
std
::
nothrow
)
raw_decoder_t
(
options
.
rcvbuf
);
decoder
=
new
(
std
::
nothrow
)
raw_decoder_t
(
in_batch_size
);
alloc_assert
(
decoder
);
// disable handshaking for raw socket
...
...
@@ -374,12 +374,12 @@ void zmq::stream_engine_t::out_event ()
outpos
=
NULL
;
outsize
=
encoder
->
encode
(
&
outpos
,
0
);
while
(
outsize
<
(
size_t
)
o
ptions
.
sndbuf
)
{
while
(
outsize
<
(
size_t
)
o
ut_batch_size
)
{
if
((
this
->*
next_msg
)
(
&
tx_msg
)
==
-
1
)
break
;
encoder
->
load_msg
(
&
tx_msg
);
unsigned
char
*
bufptr
=
outpos
+
outsize
;
size_t
n
=
encoder
->
encode
(
&
bufptr
,
o
ptions
.
sndbuf
-
outsize
);
size_t
n
=
encoder
->
encode
(
&
bufptr
,
o
ut_batch_size
-
outsize
);
zmq_assert
(
n
>
0
);
if
(
outpos
==
NULL
)
outpos
=
bufptr
;
...
...
@@ -576,10 +576,10 @@ bool zmq::stream_engine_t::handshake ()
return
false
;
}
encoder
=
new
(
std
::
nothrow
)
v1_encoder_t
(
o
ptions
.
sndbuf
);
encoder
=
new
(
std
::
nothrow
)
v1_encoder_t
(
o
ut_batch_size
);
alloc_assert
(
encoder
);
decoder
=
new
(
std
::
nothrow
)
v1_decoder_t
(
options
.
rcvbuf
,
options
.
maxmsgsize
);
decoder
=
new
(
std
::
nothrow
)
v1_decoder_t
(
in_batch_size
,
options
.
maxmsgsize
);
alloc_assert
(
decoder
);
// We have already sent the message header.
...
...
@@ -623,12 +623,11 @@ bool zmq::stream_engine_t::handshake ()
return
false
;
}
encoder
=
new
(
std
::
nothrow
)
v1_encoder_t
(
options
.
sndbuf
);
encoder
=
new
(
std
::
nothrow
)
v1_encoder_t
(
out_batch_size
);
alloc_assert
(
encoder
);
decoder
=
new
(
std
::
nothrow
)
v1_decoder_t
(
options
.
rcvbuf
,
options
.
maxmsgsize
);
in_batch_size
,
options
.
maxmsgsize
);
alloc_assert
(
decoder
);
}
else
...
...
@@ -639,19 +638,19 @@ bool zmq::stream_engine_t::handshake ()
return
false
;
}
encoder
=
new
(
std
::
nothrow
)
v2_encoder_t
(
o
ptions
.
sndbuf
);
encoder
=
new
(
std
::
nothrow
)
v2_encoder_t
(
o
ut_batch_size
);
alloc_assert
(
encoder
);
decoder
=
new
(
std
::
nothrow
)
v2_decoder_t
(
options
.
rcvbuf
,
options
.
maxmsgsize
);
in_batch_size
,
options
.
maxmsgsize
);
alloc_assert
(
decoder
);
}
else
{
encoder
=
new
(
std
::
nothrow
)
v2_encoder_t
(
o
ptions
.
sndbuf
);
encoder
=
new
(
std
::
nothrow
)
v2_encoder_t
(
o
ut_batch_size
);
alloc_assert
(
encoder
);
decoder
=
new
(
std
::
nothrow
)
v2_decoder_t
(
options
.
rcvbuf
,
options
.
maxmsgsize
);
in_batch_size
,
options
.
maxmsgsize
);
alloc_assert
(
decoder
);
if
(
options
.
mechanism
==
ZMQ_NULL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment