chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-3089621989
> 多 client 场景中会出现大片 RPC 超时 [E110]Fail to connect Socket ... : Connection
timed out [E1008]Reached timeout=2500ms
>
 {
bool TaskControl::steal_task(bthread_t* tid, size_t* seed, s
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2899732430
> @zhengJade Thank you for your contribution!
PR 有问题直接圈我来修,最近换工作有点忙,才来看
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to Git
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2899730819
> > > 我问一下,如果把epoll变成bthread_start_urgent和按照优先级队列处理epoll,最终执行的逻辑上看有什么区别呢?
> >
> >
> > @yanglimingcn ”把epoll变成bthread_start_urgent“指的是哪部分?现在epoll
bthread处理都是bthread_start_urgent处理
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2899729686
> 多 client 场景中会出现大片 RPC 超时 [E110]Fail to connect Socket ... : Connection
timed out [E1008]Reached timeout=2500ms
 {
bool TaskControl::steal_task(bthread_t* tid, size_t* seed, si
wwbmmm commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r2041844626
##
src/bthread/task_control.cpp:
##
@@ -430,6 +435,11 @@ int TaskControl::_destroy_group(TaskGroup* g) {
bool TaskControl::steal_task(bthread_t* tid, size_t* seed, size_
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r2041499486
##
src/bthread/task_control.cpp:
##
@@ -430,6 +435,11 @@ int TaskControl::_destroy_group(TaskGroup* g) {
bool TaskControl::steal_task(bthread_t* tid, size_t* seed, si
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r2041505792
##
src/bthread/task_group.h:
##
@@ -200,6 +200,8 @@ class TaskGroup {
return total_ns;
}
+const bthread_attr_t& get_current_attr() { return _cur_meta
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r2041500195
##
src/brpc/event_dispatcher_epoll.cpp:
##
@@ -70,7 +70,8 @@ int EventDispatcher::Start(const bthread_attr_t*
consumer_thread_attr) {
// Set _thread_attr before cr
wwbmmm commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r2030365543
##
src/bthread/task_control.h:
##
@@ -153,6 +157,7 @@ friend bthread_t init_for_pthread_stack_trace();
std::vector*> _tagged_cumulated_worker_time;
std::vector>*>
chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2775892073
> > LGTM
> > @wwbmmm @yanglimingcn 有时间再看看。
>
> 这个还有希望合进去嘛
@wwbmmm @yanglimingcn ping
--
This is an automated message from the Apache Git Service.
To respond to the messa
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2771867928
> LGTM
>
> @wwbmmm @yanglimingcn 有时间再看看。
这个还有希望合进去嘛
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use t
chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2742463997
LGTM
--
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,
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r2006910823
##
src/bthread/task_control.h:
##
@@ -96,6 +97,12 @@ friend bthread_t init_for_pthread_stack_trace();
void stack_trace(std::ostream& os, bthread_t tid);
std::s
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r2004723967
##
src/bthread/task_control.h:
##
@@ -96,6 +97,12 @@ friend bthread_t init_for_pthread_stack_trace();
void stack_trace(std::ostream& os, bthread_t tid);
std::s
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1998048965
##
src/bthread/task_control.h:
##
@@ -96,6 +97,12 @@ friend bthread_t init_for_pthread_stack_trace();
void stack_trace(std::ostream& os, bthread_t tid);
std::s
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1995120152
##
src/bthread/task_group.h:
##
@@ -199,6 +200,10 @@ class TaskGroup {
total_ns += butil::cputhread_time_ns() - _last_cpu_clock_ns;
return total_ns;
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1995119831
##
src/bthread/task_control.h:
##
@@ -96,6 +97,12 @@ friend bthread_t init_for_pthread_stack_trace();
void stack_trace(std::ostream& os, bthread_t tid);
std::s
chenBright commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1996856220
##
src/bthread/task_control.h:
##
@@ -96,6 +97,12 @@ friend bthread_t init_for_pthread_stack_trace();
void stack_trace(std::ostream& os, bthread_t tid);
std::
chenBright commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1995775619
##
src/bthread/task_control.h:
##
@@ -96,6 +97,12 @@ friend bthread_t init_for_pthread_stack_trace();
void stack_trace(std::ostream& os, bthread_t tid);
std::
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1995118485
##
src/bthread/task_group.h:
##
@@ -278,6 +285,7 @@ friend class TaskControl;
// Worker thread id.
pid_t _tid;
+std::unordered_set _epoll_tids;
Review C
chenBright commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1992640728
##
src/bthread/task_group.h:
##
@@ -199,6 +200,10 @@ class TaskGroup {
total_ns += butil::cputhread_time_ns() - _last_cpu_clock_ns;
return total_ns;
chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2719769290
> > > 如果确实希望epoll bthread
优先处理,把它启动的bthread_start_urgent变成可配置的bthread_start_urgent/background可行吗
> >
> >
> > 这里的bthread_start_urgent是精心设计的吧,cache局部性更优。
> > 直接配成bthread_start_
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2717035278
> > PR #2907 单独实现了第二个优化,看起来更优雅一些。 第一个优化可以再讨论一下 @chenBright
>
> @zhengJade #2907 已经合了,可以rebase master更新一下这个PR吗?
>
> 可以再测一下,观察#2897 加的指标,看看epoll调度是否变快了吗?
@chenBright 以下是 5
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2716293661
> > 如果确实希望epoll bthread
优先处理,把它启动的bthread_start_urgent变成可配置的bthread_start_urgent/background可行吗
>
> 这里的bthread_start_urgent是精心设计的吧,cache局部性更优。
>
> 直接配成bthread_start_backgruond好
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2716289023
> > PR #2907 单独实现了第二个优化,看起来更优雅一些。 第一个优化可以再讨论一下 @chenBright
>
> @zhengJade #2907 已经合了,可以rebase master更新一下这个PR吗?
>
> 可以再测一下,观察#2897 加的指标,看看epoll调度是否变快了吗?
@chenBright 单独的第
yanglimingcn commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2703793985
如果确实希望epoll bthread
优先处理,把它启动的bthread_start_urgent变成可配置的bthread_start_urgent/background可行吗
--
This is an automated message from the Apache Git Service.
To respond to the message, plea
chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2703963457
> 如果确实希望epoll bthread
优先处理,把它启动的bthread_start_urgent变成可配置的bthread_start_urgent/background可行吗
这里的bthread_start_urgent是精心设计的吧,cache局部性更优。
epoll事件处理完之后,也还是有优先处理的需求吧?
--
This
chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2703646545
> PR #2907 单独实现了第二个优化,看起来更优雅一些。 第一个优化可以再讨论一下 @chenBright
@zhengJade #2907 已经合了,可以rebase master更新一下这个PR吗?
可以再测一下,观察#2897 加的指标,看看epoll调度是否变快了吗?
--
This is an automated messag
wwbmmm commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2702690765
PR https://github.com/apache/brpc/pull/2907 单独实现了第二个优化,看起来更优雅一些。
第一个优化可以再讨论一下 @chenBright
--
This is an automated message from the Apache Git Service.
To respond to the message, please l
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2702675196
> 这个PR啥时候能merge上去啊
@zhoukangsheng 好像需要社区的大佬们再看看,很久没回我了
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
U
zhoukangsheng commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2696028124
这个PR啥时候能merge上去啊
--
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.
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2586114214
> > 能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
>
> +1。 进一步抽象出一个高优先级队列,使用WorkStealingQueue来实现:
>
> 1. 简化实现逻辑。
> 2. 后续还有高优先级的bthread,只需要设置对应的bthread_
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1909938624
##
src/bthread/parking_lot.h:
##
@@ -30,6 +30,7 @@ namespace bthread {
// Park idle workers.
class BAIDU_CACHELINE_ALIGNMENT ParkingLot {
public:
+static butil::a
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2581959165
> 优化前后长尾延迟没看到明显的变化?
长尾是指?
--
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 specifi
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2581958586
> 2\. bthread_attrflags_t
> 如果网络事件非常频繁的话,是不是可以直接让epoll thread不切走呢?比如把这里:
https://github.com/apache/brpc/blob/master/src/brpc/socket.cpp#L2265
改成bthread_start_background是否也可以
MJY-HUST commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1906923179
##
src/bthread/parking_lot.h:
##
@@ -30,6 +30,7 @@ namespace bthread {
// Park idle workers.
class BAIDU_CACHELINE_ALIGNMENT ParkingLot {
public:
+static butil::at
rowe0x commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2576595080
优化前后长尾延迟没看到明显的变化?
--
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 uns
wwbmmm commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2526803281
如果网络事件非常频繁的话,是不是可以直接让epoll thread不切走呢?比如把这里:
https://github.com/apache/brpc/blob/master/src/brpc/socket.cpp#L2265
改成bthread_start_background是否也可以提升性能呢?
--
This is an automated message fr
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1875217593
##
src/brpc/event_dispatcher.cpp:
##
@@ -55,6 +55,7 @@ void InitializeGlobalDispatchers() {
FLAGS_usercode_in_pthread ? BTHREAD_ATTR_PTHREAD :
BTHREAD_
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2526735379
最近新春,公司太忙了,没时间搞这个 PR (><),等我这边喘口气,改成优先队列,然后多客户端再测试一次
--
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
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2526733718
> > * epoll 线程和其他 bthread 具有相同优先级,导致 epoll 线程可能被一小段时间在队列中无响应,引起 worker queue
任务数量分布不均匀,多对一的 steal。
> > * 网络事件无差别 signal,增加了系统调用。
>
> 能否分别测一下这两个优化各自提升多少性能呢? 我觉得第二个可能更重要一些,而且也更通用,可以
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2526709128
> > > 能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
另外,总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
> >
> >
> > @yanglimingcn 我觉得可以增加一个属性来表示高优先级,但是要说明一点,就是 epol
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1875215957
##
src/bthread/task_control.cpp:
##
@@ -441,6 +453,18 @@ void TaskControl::signal_task(int num_task, bthread_tag_t
tag) {
if (num_task > 2) {
num_task = 2
wwbmmm commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2526622151
> * epoll 线程和其他 bthread 具有相同优先级,导致 epoll 线程可能被一小段时间在队列中无响应,引起 worker queue
任务数量分布不均匀,多对一的 steal。
> * 网络事件无差别 signal,增加了系统调用。
能否分别测一下这两个优化各自提升多少性能呢?
我觉得第二个可能更重要一些,而且也更通用,可以把第二个优化单独
wwbmmm commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1875149987
##
src/brpc/event_dispatcher.cpp:
##
@@ -55,6 +55,7 @@ void InitializeGlobalDispatchers() {
FLAGS_usercode_in_pthread ? BTHREAD_ATTR_PTHREAD :
BTHREAD_ATT
chenBright commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1853350137
##
src/bthread/task_control.cpp:
##
@@ -441,6 +453,18 @@ void TaskControl::signal_task(int num_task, bthread_tag_t
tag) {
if (num_task > 2) {
num_task =
yanglimingcn commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2490950097
> > 能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
另外,总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
>
> @yanglimingcn 我觉得可以增加一个属性来表示高优先级,但是要说明一点,就是 epoll 的 任务被 ste
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2490597540
> > 能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
另外,总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
>
> 1 你说得对,是有点特化,这么改简单点
>
> 如果是带优先级的bthread 可能就得改调度了,涉及到任务抢
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1851691050
##
src/bthread/parking_lot.h:
##
@@ -40,7 +41,7 @@ class BAIDU_CACHELINE_ALIGNMENT ParkingLot {
int val;
};
-ParkingLot() : _pending_signal(0) {}
+
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2490582269
> @zhengJade 延时性能的提升主要是因为epoll bthread优先调度了吗?
@chenBright
从理论上看应该有两方面原因
1. epoll 响应更及时,导致整个 brpc 的处理优先级逻辑发生了变化,以前是所有的 worker 尽量先处理完所有的任务,才能保证有新的
event 进来,当然,没处理完也有会,这取决于是否 steal 到
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2490558740
> > 总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
>
> 现在只有一个连接,epoll bthread调度不是很频繁。是不是可以起多一些client和epoll bthread再测一下呢?
好的,我再测试一下多 client 的效果
--
This is an automated message from
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2490551846
> 能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
另外,总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
我觉得可以增加一个属性来表示高优先级,但是要说明一点,就是 epoll 的 任务被 steal 的前提肯定是有 worker 需要 st
zhengJade commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2490512341
> > 总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
>
> 现在只有一个连接,epoll bthread调度不是很频繁。是不是可以起多一些client和epoll bthread再测一下呢?
--
This is an automated message from the Apache Git Servic
zhengJade closed pull request #2819: epoll bthread deal first
URL: https://github.com/apache/brpc/pull/2819
--
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-ma
yanglimingcn commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2490017008
> > 能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
另外,总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
>
> 1 你说得对,是有点特化,这么改简单点
>
> 如果是带优先级的bthread 可能就得改调度了,涉及到
yanglimingcn commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2489919968
能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
另外,总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
--
This is an automated message from the Apache Git Service.
To respo
chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2489944238
@zhengJade 延时性能的提升主要是因为epoll bthread优先调度了吗?
--
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
chenBright commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1849423762
##
src/bthread/parking_lot.h:
##
@@ -40,7 +41,7 @@ class BAIDU_CACHELINE_ALIGNMENT ParkingLot {
int val;
};
-ParkingLot() : _pending_signal(0) {}
+
wanghenshui commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2489943405
1 你说得对,是有点特化,这么改简单点
如果是带优先级的bthread 可能就得改调度了,涉及到任务抢占/饥饿问题,可能麻烦一点
2 你说的也对可能会堆积,但是epoll任务是比较少的
如果改了优先级,会存在你说的优先级高的任务太多导致其他任务饿死
wanghenshui commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2489942731
> 能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
另外,总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
1 你说得对,是有点特化,这么改简单点
如果是带优先级的bthread 可能就得改调度了,涉及到任务抢占/饥饿问题,可
chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2489940901
> 总是让epoll的bthread优先调度的话,会不会造成堆积很多任务的情况呢?
现在只有一个连接,epoll bthread调度不是很频繁。是不是可以起多一些client和epoll bthread再测一下呢?
--
This is an automated message from the Apache Git Service.
To respond
chenBright commented on PR #2819:
URL: https://github.com/apache/brpc/pull/2819#issuecomment-2489938094
> 能否在bthread这个层面上,创建协程的时候设置一个属性,使它具有更高的优先级呢?现在这里专门设置了epoll_XXX,感觉有点特化。
+1。
进一步抽象出一个高优先级队列,使用WorkStealingQueue来实现:
1. 简化实现逻辑。
2. 后续还有高优先级的bthread,只需要设置对应的bthread_attrflag
zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1847934237
##
src/bthread/task_control.cpp:
##
@@ -401,6 +402,17 @@ int TaskControl::_destroy_group(TaskGroup* g) {
bool TaskControl::steal_task(bthread_t* tid, size_t* seed, si
wanghenshui commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1841526767
##
src/bthread/task_control.cpp:
##
@@ -401,6 +402,17 @@ int TaskControl::_destroy_group(TaskGroup* g) {
bool TaskControl::steal_task(bthread_t* tid, size_t* seed,
zhengJade opened a new pull request, #2819:
URL: https://github.com/apache/brpc/pull/2819
### What problem does this PR solve?
对 brpc 先有性能做了提升
Problem Summary:
目前的 brpc 网络事件存在两个问题
1. epoll 线程和其他 bthread 具有相同优先级,导致 epoll 线程可能被一小段时间在队列中无响应,引起 worker queue
任务数量分布不均匀,多对一的 steal。
76 matches
Mail list logo