You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2019/12/29 09:24:17 UTC
[GitHub] [incubator-brpc] TousakaRin opened a new pull request #1005: ignore
ELIMIT for circuit breaker
TousakaRin opened a new pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005
为熔断忽略ELIMIT错误
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zyearn commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
zyearn commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r361897662
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -14,13 +14,22 @@
//
// Authors: Lei He (helei@qiyi.com)
+#include "brpc/circuit_breaker.h"
+
#include <cmath>
+#include <set>
+#include <mutex>
#include <gflags/gflags.h>
-#include <butil/time.h>
-#include "brpc/circuit_breaker.h"
+
+#include "butil/strings/string_number_conversions.h"
+#include "butil/strings/string_split.h"
+#include "butil/time.h"
namespace brpc {
+DEFINE_string(circuit_breaker_ignored_error_codes, "2004",
Review comment:
如果是可配置的,说明用户在某些场景需要不ignore ELIMIT么
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] jamesge merged pull request #1005: ignore ELIMIT
for circuit breaker
Posted by GitBox <gi...@apache.org>.
jamesge merged pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] jamesge commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
jamesge commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r362366503
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -171,6 +206,10 @@ CircuitBreaker::CircuitBreaker()
}
bool CircuitBreaker::OnCallEnd(int error_code, int64_t latency) {
+ const std::set<int>* ignored_error_codes = GetOrNewIgnoredErrorCodes();
Review comment:
1. 我记得曾忽略过ELIMIT?
2. 如果一定要忽略,建议写死并说明理由
3. 如果一定需要可配置,应该把error code有序地存在vector中,在比较短时直接find,比较长时std::binary_search
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] TousakaRin commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
TousakaRin commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r368785730
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -171,6 +206,10 @@ CircuitBreaker::CircuitBreaker()
}
bool CircuitBreaker::OnCallEnd(int error_code, int64_t latency) {
+ const std::set<int>* ignored_error_codes = GetOrNewIgnoredErrorCodes();
Review comment:
已经改成写死在代码里并且添加了注释
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] jamesge commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
jamesge commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r368793073
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -15,10 +15,16 @@
// specific language governing permissions and limitations
// under the License.
+#include "brpc/circuit_breaker.h"
+
#include <cmath>
#include <gflags/gflags.h>
-#include <butil/time.h>
-#include "brpc/circuit_breaker.h"
+
+#include "brpc/errno.pb.h"
+#include "butil/logging.h"
+#include "butil/strings/string_number_conversions.h"
+#include "butil/strings/string_split.h"
+#include "butil/time.h"
Review comment:
头文件这段还需要修改么?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zyearn commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
zyearn commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r362364866
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -14,13 +14,22 @@
//
// Authors: Lei He (helei@qiyi.com)
+#include "brpc/circuit_breaker.h"
+
#include <cmath>
+#include <set>
+#include <mutex>
#include <gflags/gflags.h>
-#include <butil/time.h>
-#include "brpc/circuit_breaker.h"
+
+#include "butil/strings/string_number_conversions.h"
+#include "butil/strings/string_split.h"
+#include "butil/time.h"
namespace brpc {
+DEFINE_string(circuit_breaker_ignored_error_codes, "2004",
Review comment:
如果某些错误码是一定要ignore的,可以写死在代码里,以防止用户在flags里漏加了
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] TousakaRin commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
TousakaRin commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r362206785
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -14,13 +14,22 @@
//
// Authors: Lei He (helei@qiyi.com)
+#include "brpc/circuit_breaker.h"
+
#include <cmath>
+#include <set>
+#include <mutex>
#include <gflags/gflags.h>
-#include <butil/time.h>
-#include "brpc/circuit_breaker.h"
+
+#include "butil/strings/string_number_conversions.h"
+#include "butil/strings/string_split.h"
+#include "butil/time.h"
namespace brpc {
+DEFINE_string(circuit_breaker_ignored_error_codes, "2004",
Review comment:
我的考虑是是否有可能还需要忽略其他错误码
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zyearn commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
zyearn commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r361895580
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -56,6 +65,24 @@ namespace {
#define EPSILON (FLAGS_circuit_breaker_epsilon_value)
+std::once_flag g_init_ignored_error_codes_once;
+std::set<int> g_ignored_error_codes;
Review comment:
这个要实现成指针,第一次使用时初始化,不然会在main函数之前还未构造但被使用 or main函数之后已析构但还在使用
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] jamesge commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
jamesge commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r368792573
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -172,6 +178,16 @@ CircuitBreaker::CircuitBreaker()
}
bool CircuitBreaker::OnCallEnd(int error_code, int64_t latency) {
+ // If the server has reached its maximum concurrency, it will return
+ // ELIMIT directly when a new request arrives. This usually means that
+ // the entire downstream cluster is overloaded. If we isolate nodes at
+ // this time, may increase the pressure on downstream. On the other hand,
+ // since the latency corresponding to ELIMIT is usually very small, we
+ // cannot handle it as a successful request.Here we simply ignore the requests
+ // that returns ELIMIT.
+ if (error_code == ELIMIT) {
+ return true;
Review comment:
缩进不对
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zyearn commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
zyearn commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r368795982
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -172,6 +175,16 @@ CircuitBreaker::CircuitBreaker()
}
bool CircuitBreaker::OnCallEnd(int error_code, int64_t latency) {
+ // If the server has reached its maximum concurrency, it will return
+ // ELIMIT directly when a new request arrives. This usually means that
+ // the entire downstream cluster is overloaded. If we isolate nodes at
+ // this time, may increase the pressure on downstream. On the other hand,
+ // since the latency corresponding to ELIMIT is usually very small, we
+ // cannot handle it as a successful request.Here we simply ignore the requests
+ // that returns ELIMIT.
Review comment:
1. miss a space before 'Here'
2. 'returns' -> 'returned'
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] TousakaRin commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
TousakaRin commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r368798772
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -172,6 +175,16 @@ CircuitBreaker::CircuitBreaker()
}
bool CircuitBreaker::OnCallEnd(int error_code, int64_t latency) {
+ // If the server has reached its maximum concurrency, it will return
+ // ELIMIT directly when a new request arrives. This usually means that
+ // the entire downstream cluster is overloaded. If we isolate nodes at
+ // this time, may increase the pressure on downstream. On the other hand,
+ // since the latency corresponding to ELIMIT is usually very small, we
+ // cannot handle it as a successful request.Here we simply ignore the requests
+ // that returns ELIMIT.
Review comment:
fixed
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] TousakaRin commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
TousakaRin commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r362206593
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -56,6 +65,24 @@ namespace {
#define EPSILON (FLAGS_circuit_breaker_epsilon_value)
+std::once_flag g_init_ignored_error_codes_once;
+std::set<int> g_ignored_error_codes;
Review comment:
这里是存在这个问题,和其他代码一样用pthread_once + 指针到方式初始化了
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] TousakaRin commented on a change in pull request
#1005: ignore ELIMIT for circuit breaker
Posted by GitBox <gi...@apache.org>.
TousakaRin commented on a change in pull request #1005: ignore ELIMIT for circuit breaker
URL: https://github.com/apache/incubator-brpc/pull/1005#discussion_r368795402
##########
File path: src/brpc/circuit_breaker.cpp
##########
@@ -15,10 +15,16 @@
// specific language governing permissions and limitations
// under the License.
+#include "brpc/circuit_breaker.h"
+
#include <cmath>
#include <gflags/gflags.h>
-#include <butil/time.h>
-#include "brpc/circuit_breaker.h"
+
+#include "brpc/errno.pb.h"
+#include "butil/logging.h"
+#include "butil/strings/string_number_conversions.h"
+#include "butil/strings/string_split.h"
+#include "butil/time.h"
Review comment:
把几个不必要的头文件删掉了
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org