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
491a1860
Commit
491a1860
authored
Dec 04, 2019
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redis_server_protocol: clear arena in rediscxt asap
parent
d35efefd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
7 deletions
+2
-7
redis_protocol.cpp
src/brpc/policy/redis_protocol.cpp
+2
-7
No files found.
src/brpc/policy/redis_protocol.cpp
View file @
491a1860
...
...
@@ -47,9 +47,6 @@ DEFINE_bool(redis_verbose, false,
"[DEBUG] Print EVERY redis request/response"
);
DEFINE_int32
(
redis_batch_flush_max_size
,
2048
,
"beyond which the server response"
" are forced to write to socket"
);
DEFINE_int32
(
redis_max_request_count_before_clear_arena
,
10000
,
"If the number of "
"incoming requests has reached multiple of this value, arena from which the "
"requests are allocated will be cleared."
);
struct
InputResponse
:
public
InputMessageBase
{
bthread_id_t
id_wait
;
...
...
@@ -166,7 +163,7 @@ int ConsumeTask(RedisConnContext* ctx, ConsumeTaskDone* done) {
}
else
{
std
::
string
comm
;
comm
.
reserve
(
8
);
for
(
const
char
*
c
=
done
->
input_message
[
0
].
c_str
()
;
*
c
;
++
c
)
{
for
(
const
char
*
c
=
args
[
0
]
;
*
c
;
++
c
)
{
comm
.
push_back
(
std
::
tolower
(
*
c
));
}
auto
it
=
ctx
->
command_map
.
find
(
comm
);
...
...
@@ -338,9 +335,7 @@ ParseResult ParseRedisMessage(butil::IOBuf* source, Socket* socket,
std
::
unique_ptr
<
ConsumeTaskDone
>
done
(
new
ConsumeTaskDone
);
done
->
input_message
.
CopyFromDifferentArena
(
ctx
->
parsing_message
,
&
done
->
arena
);
ctx
->
parsing_message
.
Clear
();
if
((
++
ctx
->
message_count
%
FLAGS_redis_max_request_count_before_clear_arena
)
==
0
)
{
ctx
->
arena
.
clear
();
}
ctx
->
arena
.
clear
();
// Add a ref that removed in ConsumeTaskDone::Run
ctx
->
AddRefManually
();
if
(
bthread
::
execution_queue_execute
(
ctx
->
queue
,
done
.
get
())
!=
0
)
{
...
...
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