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 2022/09/19 16:15:06 UTC

[GitHub] [incubator-brpc] icexin opened a new issue, #1930: 默认熔断策略中的connect_timeout_ms

icexin opened a new issue, #1930:
URL: https://github.com/apache/incubator-brpc/issues/1930

   根据文档中对默认熔断策略的描述 https://github.com/apache/incubator-brpc/blob/master/docs/cn/circuit_breaker.md#%E9%BB%98%E8%AE%A4%E7%9A%84%E7%86%94%E6%96%AD%E7%AD%96%E7%95%A5
   
   > 所以假如rpc的超时时间设置的比连接超时更短,那么当节点无法建立连接时,rpc超时会比连接超时更早触发,最终导致永远触发不了熔断。所以在自定义超时时间时,需要保证rpc的超时时间大于连接超时时间。即ChannelOptions.timeout_ms > ChannelOptions.connect_timeout_ms
   
   为什么如果`timeout_ms `小于`connect_timeout_ms`会永远触发不了熔断?
   
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "dandyhuang (via GitHub)" <gi...@apache.org>.
dandyhuang commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521362040

   > 如果连接时有ECONNREFUSED 、ENETUNREACH、EHOSTUNREACH错误,就会熔断
   
   这里的熔断是Socket SetFailed吗,后续就不会使用吗? 怎么跟服务发现后的socket list关联起来。


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "dandyhuang (via GitHub)" <gi...@apache.org>.
dandyhuang commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521361306

   > Socket SetFailed
   
   这里的熔断是Socket SetFailed吗,后续就不会使用吗? 怎么跟服务发现后的socket list关联起来。


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521055179

   > > 如果出现连续三次连接超时,brpc会把[连接超时作为网络不可达来处理](https://github.com/apache/incubator-brpc/blob/3e054ab3a521ed66eb19ff1dd124f6303cfad537/src/brpc/socket.cpp#L1358),进一步的对这个socket进行熔断。timeout 设置得过小时总是会先出发 rpc timeout,导致上面这段逻辑触发不了。
   > 
   > 如果代码执行了,那就是 err = ENETUNREACH; 那怎么触发的熔断呢,大佬能在帮忙解释一下吗
   
   @dandyhuang 在rpc的OnComplete函数里判断error_code是ECONNREFUSED 、ENETUNREACH、EHOSTUNREACH、EINVAL其中一个,则将Socket SetFailed(熔断)。下次rpc就不会选中该Failed Socket。


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "dandyhuang (via GitHub)" <gi...@apache.org>.
dandyhuang commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521257786

   > does_error_affect_main_socket
   
   只有发生错误,才会调用OnComplete是吧,其他正常都是发送数据。  但是我看了AfterAppConnected也会调用Socket SetFailed。 那么文档所说的, 默认熔断connect_timeout_ms<rpc_timeout_ms 才会触发熔断。 感觉connect_timeout_ms> timeout_ms也一样,都会将Socket SetFailed


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521357370

   如果连接时有ECONNREFUSED 、ENETUNREACH、EHOSTUNREACH错误,就会熔断


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521233753

   https://github.com/apache/brpc/blob/31a162bfdd70770c0237246efc5f366919d36807/src/brpc/controller.cpp#L747-L755
   根据error_code操作Socket


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521294661

   文档中说的是连接超时和rpc超时,没有说其他错误的情况。如果connect_timeout_ms > timeout_ms,超时的话,只会触发rpc超时,不会触发连接超时。


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] cdjingit commented on issue #1930: 默认熔断策略中的connect_timeout_ms

Posted by GitBox <gi...@apache.org>.
cdjingit commented on issue #1930:
URL: https://github.com/apache/incubator-brpc/issues/1930#issuecomment-1253644605

   应该是触发不了连接超时导致的熔断


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521234650

   连接超时、连接断开(EOF、RST)也会将Socket SetFailed


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "dandyhuang (via GitHub)" <gi...@apache.org>.
dandyhuang commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521404879

   > SetFailed后启动健康检查,检查通过后,后续会继续使用。
   > 
   > 从服务发现获取到的节点信息,创建对应的Socket,保存在SocketMap中。LB中保存这些Socke的id。选路的时候,判断SocketId对应的Socket时候可用才会使用Socket。 https://github.com/apache/brpc/blob/master/docs/cn/client.md#%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1
   
   感谢大佬,我去看下选路的判断,辛苦了


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
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 issue #1930: 默认熔断策略中的connect_timeout_ms

Posted by GitBox <gi...@apache.org>.
TousakaRin commented on issue #1930:
URL: https://github.com/apache/incubator-brpc/issues/1930#issuecomment-1254595392

   如果出现连续三次连接超时,brpc会把[连接超时作为网络不可达来处理](https://github.com/apache/incubator-brpc/blob/3e054ab3a521ed66eb19ff1dd124f6303cfad537/src/brpc/socket.cpp#L1358),进一步的对这个socket进行熔断。timeout 设置得过小时总是会先出发 rpc timeout,导致上面这段逻辑触发不了。


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] TousakaRin closed issue #1930: 默认熔断策略中的connect_timeout_ms

Posted by GitBox <gi...@apache.org>.
TousakaRin closed issue #1930: 默认熔断策略中的connect_timeout_ms
URL: https://github.com/apache/incubator-brpc/issues/1930


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "dandyhuang (via GitHub)" <gi...@apache.org>.
dandyhuang commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1519965848

   > 如果出现连续三次连接超时,brpc会把[连接超时作为网络不可达来处理](https://github.com/apache/incubator-brpc/blob/3e054ab3a521ed66eb19ff1dd124f6303cfad537/src/brpc/socket.cpp#L1358),进一步的对这个socket进行熔断。timeout 设置得过小时总是会先出发 rpc timeout,导致上面这段逻辑触发不了。
   
   如果代码执行了,那就是 err = ENETUNREACH; 那怎么触发的熔断呢,大佬能在帮忙解释一下吗


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "dandyhuang (via GitHub)" <gi...@apache.org>.
dandyhuang commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521302357

   > 文档中说的是连接超时和rpc超时,没有说其他错误的情况。如果connect_timeout_ms > timeout_ms,超时的话,只会触发rpc超时,不会触发连接超时。
   
   是,都是两个定时器。 我想知道的是,如果connect_timeout_ms > timeout_ms。那么会不会不会触发熔断呢。 因为timeout_ms超时的时候,OnComplete不会有ECONNREFUSED 、ENETUNREACH、EHOSTUNREACH、EINVAL其中一个错误,所以不会触发熔断呢。  


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "dandyhuang (via GitHub)" <gi...@apache.org>.
dandyhuang commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521083665

   > > > 如果出现连续三次连接超时,brpc会把[连接超时作为网络不可达来处理](https://github.com/apache/incubator-brpc/blob/3e054ab3a521ed66eb19ff1dd124f6303cfad537/src/brpc/socket.cpp#L1358),进一步的对这个socket进行熔断。timeout 设置得过小时总是会先出发 rpc timeout,导致上面这段逻辑触发不了。
   > > 
   > > 
   > > 如果代码执行了,那就是 err = ENETUNREACH; 那怎么触发的熔断呢,大佬能在帮忙解释一下吗
   > 
   > @dandyhuang 在rpc的OnComplete函数里判断error_code是ECONNREFUSED 、ENETUNREACH、EHOSTUNREACH、EINVAL其中一个,则将Socket SetFailed(熔断)。下次rpc就不会选中该Failed Socket。
   
   controller里头的SetFailed是不是不会对Socket有影响。另外是不是只有这四种错误才会有问题,其他都不会导致Socket SetFailed是吗


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 默认熔断策略中的connect_timeout_ms (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #1930:
URL: https://github.com/apache/brpc/issues/1930#issuecomment-1521374514

   SetFailed后启动健康检查,检查通过后,后续会继续使用。
   
   从服务发现获取到的节点信息,创建对应的Socket,保存在SocketMap中。LB中保存这些Socke的id。选路的时候,判断SocketId对应的Socket时候可用才会使用Socket。


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org