Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
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
brpc
Commits
563df5ec
Commit
563df5ec
authored
Oct 10, 2018
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Directly allocate unsent message instead of preparing them first
parent
5947fed8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
19 deletions
+11
-19
brpc_h2_unsent_message_unittest.cpp
test/brpc_h2_unsent_message_unittest.cpp
+11
-19
No files found.
test/brpc_h2_unsent_message_unittest.cpp
View file @
563df5ec
...
...
@@ -36,45 +36,37 @@ TEST(H2UnsentMessage, request_throughput) {
ctx
->
_last_client_stream_id
=
0
;
ctx
->
_remote_window_left
=
brpc
::
H2Settings
::
MAX_WINDOW_SIZE
;
int64_t
ntotal
=
1
000000
;
int64_t
ntotal
=
5
000000
;
// calc H2UnsentRequest throughput
std
::
vector
<
brpc
::
policy
::
H2UnsentRequest
*>
req_msgs
;
req_msgs
.
resize
(
ntotal
);
for
(
int
i
=
0
;
i
<
ntotal
;
++
i
)
{
req_msgs
[
i
]
=
brpc
::
policy
::
H2UnsentRequest
::
New
(
&
cntl
);
}
butil
::
IOBuf
dummy_buf
;
ProfilerStart
(
"h2_unsent_req.prof"
);
int64_t
start_us
=
butil
::
gettimeofday_us
();
for
(
int
i
=
0
;
i
<
ntotal
;
++
i
)
{
req_msgs
[
i
]
->
AppendAndDestroySelf
(
&
dummy_buf
,
h2_client_sock
.
get
());
brpc
::
policy
::
H2UnsentRequest
*
req
=
brpc
::
policy
::
H2UnsentRequest
::
New
(
&
cntl
);
req
->
AppendAndDestroySelf
(
&
dummy_buf
,
h2_client_sock
.
get
());
}
int64_t
end_us
=
butil
::
gettimeofday_us
();
ProfilerStop
();
int64_t
elapsed
=
end_us
-
start_us
;
LOG
(
INFO
)
<<
"H2UnsentRequest average qps="
<<
(
ntotal
*
1000000L
)
/
elapsed
<<
"/s, data throughput="
<<
dummy_buf
.
size
()
*
1000000L
/
elapsed
;
req_msgs
.
clear
();
<<
dummy_buf
.
size
()
*
1000000L
/
elapsed
<<
"/s"
;
// calc H2UnsentResponse throughput
std
::
vector
<
brpc
::
policy
::
H2UnsentResponse
*>
res_msgs
;
res_msgs
.
resize
(
ntotal
);
for
(
int
i
=
0
;
i
<
ntotal
;
++
i
)
{
cntl
.
http_response
().
set_content_type
(
"text/plain"
);
cntl
.
response_attachment
().
append
(
"0123456789abcedef"
);
res_msgs
[
i
]
=
brpc
::
policy
::
H2UnsentResponse
::
New
(
&
cntl
,
0
,
false
);
}
dummy_buf
.
clear
();
start_us
=
butil
::
gettimeofday_us
();
for
(
int
i
=
0
;
i
<
ntotal
;
++
i
)
{
res_msgs
[
i
]
->
AppendAndDestroySelf
(
&
dummy_buf
,
h2_client_sock
.
get
());
// H2UnsentResponse::New would release cntl.http_response() and swap
// cntl.response_attachment()
cntl
.
http_response
().
set_content_type
(
"text/plain"
);
cntl
.
response_attachment
().
append
(
"0123456789abcedef"
);
brpc
::
policy
::
H2UnsentResponse
*
res
=
brpc
::
policy
::
H2UnsentResponse
::
New
(
&
cntl
,
0
,
false
);
res
->
AppendAndDestroySelf
(
&
dummy_buf
,
h2_client_sock
.
get
());
}
end_us
=
butil
::
gettimeofday_us
();
elapsed
=
end_us
-
start_us
;
LOG
(
INFO
)
<<
"H2UnsentResponse average qps="
<<
(
ntotal
*
1000000L
)
/
elapsed
<<
"/s, data throughput="
<<
dummy_buf
.
size
()
*
1000000L
/
elapsed
;
res_msgs
.
clear
();
<<
dummy_buf
.
size
()
*
1000000L
/
elapsed
<<
"/s"
;
}
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