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
91cf5cb7
Commit
91cf5cb7
authored
Dec 31, 2019
by
Soultz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
limit minimum value of max concurrency when all requests failed
parent
f26de951
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
auto_concurrency_limiter.cpp
src/brpc/policy/auto_concurrency_limiter.cpp
+9
-5
auto_concurrency_limiter.h
src/brpc/policy/auto_concurrency_limiter.h
+2
-0
No files found.
src/brpc/policy/auto_concurrency_limiter.cpp
View file @
91cf5cb7
...
...
@@ -189,7 +189,7 @@ bool AutoConcurrencyLimiter::AddSample(int error_code,
UpdateMaxConcurrency
(
sampling_time_us
);
}
else
{
// All request failed
_max_concurrency
/=
2
;
AdjustMaxConcurrency
(
_max_concurrency
/
2
)
;
}
ResetSampleWindow
(
sampling_time_us
);
return
true
;
...
...
@@ -222,6 +222,13 @@ void AutoConcurrencyLimiter::UpdateQps(double qps) {
}
}
void
AutoConcurrencyLimiter
::
AdjustMaxConcurrency
(
int
next_max_concurrency
)
{
next_max_concurrency
=
std
::
max
(
bthread
::
FLAGS_bthread_concurrency
,
next_max_concurrency
);
if
(
next_max_concurrency
!=
_max_concurrency
)
{
_max_concurrency
=
next_max_concurrency
;
}
}
void
AutoConcurrencyLimiter
::
UpdateMaxConcurrency
(
int64_t
sampling_time_us
)
{
int32_t
total_succ_req
=
_total_succ_req
.
load
(
butil
::
memory_order_relaxed
);
double
failed_punish
=
_sw
.
total_failed_us
*
FLAGS_auto_cl_fail_punish_ratio
;
...
...
@@ -253,10 +260,7 @@ void AutoConcurrencyLimiter::UpdateMaxConcurrency(int64_t sampling_time_us) {
_min_latency_us
*
_ema_max_qps
/
1000000
*
(
1
+
_explore_ratio
);
}
next_max_concurrency
=
std
::
max
(
bthread
::
FLAGS_bthread_concurrency
,
next_max_concurrency
);
if
(
next_max_concurrency
!=
_max_concurrency
)
{
_max_concurrency
=
next_max_concurrency
;
}
AdjustMaxConcurrency
(
next_max_concurrency
);
}
}
// namespace policy
...
...
src/brpc/policy/auto_concurrency_limiter.h
View file @
91cf5cb7
...
...
@@ -62,6 +62,8 @@ private:
void
UpdateMinLatency
(
int64_t
latency_us
);
void
UpdateQps
(
double
qps
);
void
AdjustMaxConcurrency
(
int
next_max_concurrency
);
// modified per sample-window or more
int
_max_concurrency
;
int64_t
_remeasure_start_us
;
...
...
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