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 2020/02/26 06:31:03 UTC
[GitHub] [incubator-brpc] yichenluan opened a new issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
yichenluan opened a new issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047
如题,我的场景客户端会发送一批 in-flight 的请求,同时要求服务端对这些请求顺序处理并返回。
请问在 brpc 下该如何做到呢?
我认为理想的情况是我可以在收到一个完整 request 后 mute 掉该 socket 的读,当我回完 response 后再解 mute,当然要是有参数能直接控制就更好了。
@jamesge
----------------------------------------------------------------
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 edited a comment on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zyearn edited a comment on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591301973
看一下https://github.com/apache/incubator-brpc/blob/master/src/brpc/redis.h#L241 ,如果你的协议足够简单,可以考虑直接用这套接口实现server端逻辑
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591771131
> > > 如果必须诶个处理,不能有并发的话,可以在ComandHandler执行你的异步调用后调一个some_event.wait(),然后在DoneClosure里调some_event.signal()来做一个同步
> >
> >
> > 这样子不会阻塞整个 pthread 吗?我理解如果用 pthread 的 cv 的话,整个线程就休眠了吧,这样做的话,会不会所有的线程都阻塞住了,以至于别的连接上的请求都没法处理了,你看下我上面那个方案可行吗
>
> 用bthread层面的cv就可以了,或者看一下bthread/countdown_event.h也能满足需求。
好的,那应该确实可以,bthread_cv 在用户的 pthread 里 notify 也是 OK 的吧?
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591266256
补充说明:我在实现 Server 端,且是自定义协议。
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591343184
> ExecuteQueue per connection的方案我们测试过,qps上不去。在ParseMessage里,所有的CommandHandler就已经按序被调了,这个可以满足你需求么
想了一种方案,就是在 ParseMessage 时,每个 sock 的 context 维护一个 list,msg 放到 list 里,然后每次消息处理完的 done 里,将 msg pop 出来,放到线程池里,线程池的每个线程都是实际的 handler,请问有相应的 bthread pool 可以用吗
----------------------------------------------------------------
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 issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591763229
如果必须诶个处理,不能有并发的话,可以在ComandHandler执行你的异步调用后调一个some_event.wait(),然后在DoneClosure里调some_event.signal()来做一个同步
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591293693
> redis场景和你的场景是一样的,可以参考下brpc redis的实现。
额,brpc 里没实现 redis server 端的协议吧
----------------------------------------------------------------
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] zhijunfu commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zhijunfu commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-600068724
一个连接上的请求处理都必须有序的话应该可以基于brpc stream封装下,如果不需要其他brpc的功能比如timeout,load balance这些的话,吞吐很不错的
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591337108
> ExecuteQueue per connection的方案我们测试过,qps上不去。在ParseMessage里,所有的CommandHandler就已经按序被调了,这个可以满足你需求么
不太行,因为handler里有异步逻辑,DoneClosure 不一定啥时候会被调用
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591344180
或者直接使用线程池?但是这样的话原本应该是 bthread 原地调用的 handler 需要交给用户线程去处理了
----------------------------------------------------------------
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 issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591287893
redis场景和你的场景是一样的,可以参考下brpc redis的实现。
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591397556
> @yichenluan 你的需求是一个连接上的请求处理都必须有序,还是说某一批请求有序就行了?这两个问题不太一样
是前者,要求一个连接上的请求必须挨个处理,客户端会预期请求发送的顺序等同于 Server 处理的顺序。
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591304252
> 看一下https://github.com/apache/incubator-brpc/blob/master/src/brpc/redis.h#L241 ,如果你的协议足够简单,可以考虑直接用这套接口实现server端逻辑
哦,我理解了,实际上不再实现 ProcessRequest,而是将相关逻辑放在 ParseMessage 里,谢谢
----------------------------------------------------------------
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 issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591336624
ExecuteQueue per connection的方案我们测试过,qps上不去。在ParseMessage里,所有的CommandHandler就已经按序被调了,这个可以满足你需求么
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591750374
@jamesge 我现在的想法是在 ParseMessage 时,如果没有 in-flight 的消息,原地调用 Process,如果有的话,就把 InputMessageBase* 加到 context 的 list 里,然后在当前正在运行的 handle 的 DoneClosure 里,调用 bthread_start_background 处理 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.
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 issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591865180
> > > > 如果必须诶个处理,不能有并发的话,可以在ComandHandler执行你的异步调用后调一个some_event.wait(),然后在DoneClosure里调some_event.signal()来做一个同步
> > >
> > >
> > > 这样子不会阻塞整个 pthread 吗?我理解如果用 pthread 的 cv 的话,整个线程就休眠了吧,这样做的话,会不会所有的线程都阻塞住了,以至于别的连接上的请求都没法处理了,你看下我上面那个方案可行吗
> >
> >
> > 用bthread层面的cv就可以了,或者看一下bthread/countdown_event.h也能满足需求。
>
> 好的,那应该确实可以,bthread_cv 在用户的 pthread 里 notify 也是 OK 的吧?
是的
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591769467
> 如果必须诶个处理,不能有并发的话,可以在ComandHandler执行你的异步调用后调一个some_event.wait(),然后在DoneClosure里调some_event.signal()来做一个同步
这样子不会阻塞整个 pthread 吗?我理解如果用 pthread 的 cv 的话,整个线程就休眠了吧,这样做的话,会不会所有的线程都阻塞住了,以至于别的连接上的请求都没法处理了,你看下我上面那个方案可行吗
----------------------------------------------------------------
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 issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591301973
看一下https://github.com/apache/incubator-brpc/blob/master/src/brpc/redis.h#L241,如果你的协议足够简单,可以考虑直接用这套接口实现server端逻辑
----------------------------------------------------------------
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 issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591770754
> > 如果必须诶个处理,不能有并发的话,可以在ComandHandler执行你的异步调用后调一个some_event.wait(),然后在DoneClosure里调some_event.signal()来做一个同步
>
> 这样子不会阻塞整个 pthread 吗?我理解如果用 pthread 的 cv 的话,整个线程就休眠了吧,这样做的话,会不会所有的线程都阻塞住了,以至于别的连接上的请求都没法处理了,你看下我上面那个方案可行吗
用bthread层面的cv就可以了,或者看一下bthread/countdown_event.h也能满足需求。
----------------------------------------------------------------
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 issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
jamesge commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591392353
@yichenluan 你的需求是一个连接上的请求处理都必须有序,还是说某一批请求有序就行了?这两个问题不太一样
----------------------------------------------------------------
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-591309147
> 看一下https://github.com/apache/incubator-brpc/blob/master/src/brpc/redis.h#L241 ,如果你的协议足够简单,可以考虑直接用这套接口实现server端逻辑
我的场景会复杂点,我准备在 ParseMessage 里将解析出来的消息放在 ExecuteQueue 里,这样子的话每个连接会有一个 ExecuteQueue,单机可能会将近一百万的连接,请问这样子做可以吗?
----------------------------------------------------------------
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] bailiyang edited a comment on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang edited a comment on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618795897
我这边也有类似的需求,要求单链接严格有序
我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang edited a comment on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang edited a comment on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618882682
> > > > > 我这边也有类似的需求,要求单链接严格有序
> > > > > 我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
> > > >
> > > >
> > > > 这个不会呀,InputMessenger 中是 OnNewMessages 来循环处理 socket 的读 event,我现在的处理方式就是在 Parse 阶段完成消息的 decode、process,对于异步处理,会通过 bthread 的 CountdownEvent 来将 bthread 休眠
> >
> >
> > 
> > 我看process也是起一个尽量分配到当前线程的bthread来执行的,以上这一段在socket.cpp里面,由EventDispatcher在收到epoll的触发后调用
>
> 我再看看代码再回复你,不太可能 parse 阶段也会有并发问题,因为 parse 阶段才去读 socket,并发读怎么读消息呢
不好意思,我又读了下代码,这里是用原子量实现的fd粒度的锁
如果ProcessEvent正在读数据,再次ET触发的event取不到原子量不会再开协程,反而是在InputManager阶段又读到了新的数据(pipeline的情况),这样InputManager的锁不会释放反而会一直执行解包操作
如果InputManager释放了原子量,证明余下的数据都已经处理完毕了,再次ET触发的event确实应该再开一个ProcessEvent线程
这里似乎设计的很巧妙,第一眼确实没懂
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-619475343
> 可以在同一个brpc server同时支持brpc stream和普通的brpc unary,后者是可以兼容其他协议的,不知道能不能解决你的问题
>
> > > stream用起来挺不错,性能也好,不过也还有些不完善的地方,比如rpcz就不支持
> >
> >
> > stream我看了,不太符合我的要求:
> > 1.不支持除baidu_std协议之外的其他协议,我需要用到redis的RESP协议
> > 2.封装耦合非常紧密,没办法直接利用stream,直接在上面加入其他协议支持,例如Ctrl这里就有一个专门的存放streamID的private对象,正常复用没办法使用
brpc unary?这个我第一次看到,是新特性么,我去看下文档
其实我需求很简单,就是用现有框架(不局限于brpc)做一个redis的从库
因为redis从库有:
1.fd必须全双工,不能只成为server或者client
2.成为client时协议与server时协议不同(都是RESP协议但是格式不太一样)
3.需要解析RDB、AOF不同格式
4.需要支持类似UDP的发送之后不回复(REPLCONF ACK {offset})
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zhijunfu commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zhijunfu commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-619062111
stream用起来挺不错,性能也好,不过也还有些不完善的地方,比如rpcz就不支持
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-619474753
> stream用起来挺不错,性能也好,不过也还有些不完善的地方,比如rpcz就不支持
stream我看了,不太符合我的要求:
1.不支持除baidu_std协议之外的其他协议,我需要用到redis的RESP协议
2.封装耦合非常紧密,没办法直接利用stream,直接在上面加入其他协议支持,例如Ctrl这里就有一个专门的存放streamID的private对象,正常复用没办法使用
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang removed a comment on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang removed a comment on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618879117
> > > > > 我这边也有类似的需求,要求单链接严格有序
> > > > > 我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
> > > >
> > > >
> > > > 这个不会呀,InputMessenger 中是 OnNewMessages 来循环处理 socket 的读 event,我现在的处理方式就是在 Parse 阶段完成消息的 decode、process,对于异步处理,会通过 bthread 的 CountdownEvent 来将 bthread 休眠
> >
> >
> > 
> > 我看process也是起一个尽量分配到当前线程的bthread来执行的,以上这一段在socket.cpp里面,由EventDispatcher在收到epoll的触发后调用
>
> 我再看看代码再回复你,不太可能 parse 阶段也会有并发问题,因为 parse 阶段才去读 socket,并发读怎么读消息呢
我也觉得奇怪,但是https://github.com/apache/incubator-brpc/blob/master/docs/cn/io.md#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.
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] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-622347261
> @bailiyang 这块如果能有个option支持普通rpc的保序就好了,你要是改好了回头可以提个PR?看到好几个人问过这个问题了。我的场景下用stream保证了顺序,不过普通rpc要是能保序还是挺方便的
可能没办法向你说的这样做到普通rpc保序,目前的写法跟redis-server一样,执行做在parse里面而不是process里面,这样可以在拆协议之前就保证有序触发用户自定义的回调
但是这同时带来了一个新的问题:不切成多个bthread触发回调,单线程触发性能无法发挥了
我们公司为这个专门做了一个uid相关的排队锁保证强制有序,但是涉及到no_steal的bthread改动,改动非常大,提了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 to go to the specific comment.
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] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618873519
> > > > 我这边也有类似的需求,要求单链接严格有序
> > > > 我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
> > >
> > >
> > > 这个不会呀,InputMessenger 中是 OnNewMessages 来循环处理 socket 的读 event,我现在的处理方式就是在 Parse 阶段完成消息的 decode、process,对于异步处理,会通过 bthread 的 CountdownEvent 来将 bthread 休眠
>
> 
> 我看process也是起一个尽量分配到当前线程的bthread来执行的,以上这一段在socket.cpp里面,由EventDispatcher在收到epoll的触发后调用
我再看看代码再回复你,不太可能 parse 阶段也会有并发问题,因为 parse 阶段才去读 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.
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] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618795897
我这边也有类似的需求,要求单链接严格有序
我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里造成实质性的并发
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zhijunfu commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zhijunfu commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-619475151
可以在同一个brpc server同时支持brpc stream和普通的brpc unary,后者是可以兼容其他协议的,不知道能不能解决你的问题
> > stream用起来挺不错,性能也好,不过也还有些不完善的地方,比如rpcz就不支持
>
> stream我看了,不太符合我的要求:
> 1.不支持除baidu_std协议之外的其他协议,我需要用到redis的RESP协议
> 2.封装耦合非常紧密,没办法直接利用stream,直接在上面加入其他协议支持,例如Ctrl这里就有一个专门的存放streamID的private对象,正常复用没办法使用
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-619477365
> 哦,我就是指的普通的brpc,类似于grpc unary,所以我就这么叫了
>
> 我大概理解你的意思了,我记得之前有人问过保序,jamesge的说法是只有stream才能支持,其他的方式都保证不了。在普通的brpc上支持保序不知道改动大不大,估计涉及到brpc内部的一些东西,可能也不太好弄
普通的brpc接口,失去有序性主要是在CutMessage之后吧,我看了EventDispatch到Process Request层的所有代码流程,没有发现失序的地方,单个fd用原子量加锁触发,看起来不会在CutMessage之前失去顺序
如果从brpc::Socket+brpc::Accepter这一层复用的话,应该不会出现失序的情况
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] junxfl commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
junxfl commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-636665178
大神,我想通过brpc实现分布式存储的数据节点的server,通过顺序读取socket数据保证io顺序,比如client通过socket建立连接之后,通过数据消息传递io数据,服务端接收到网络数据消息之后,直接落盘,然后再次通过socket读取下一个网络数据消息,请问下,stream rpc可以实现这个功能吗?非常感谢。@jamesge @zhijunfu @bailiyang @zyearn 非常感谢
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zhijunfu commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zhijunfu commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-619055213
走brpc stream的话应该可以保证顺序处理的,底层用的是execution queue来实现的
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] yichenluan commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
yichenluan commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618808508
> 我这边也有类似的需求,要求单链接严格有序
> 我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
这个不会呀,InputMessenger 中是 OnNewMessages 来循环处理 socket 的读 event,我现在的处理方式就是在 Parse 阶段完成消息的 decode、process,对于异步处理,会通过 bthread 的 CountdownEvent 来将 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 the specific comment.
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] bailiyang removed a comment on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang removed a comment on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618824751
> Parse
参考下这个?在EventDispatch这里会并行Parse哦

你是想找东西换掉EventDispatch?否则如果两个Parse并行还是可能失去顺序啊
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] heyafei-git commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
heyafei-git commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-735369829
所以brpc的适用场景大多是无状态的读操作?
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] zhijunfu commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zhijunfu commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-620425842
@bailiyang 这块如果能有个option支持普通rpc的保序就好了,你要是改好了回头可以提个PR?看到好几个人问过这个问题了。我的场景下用stream保证了顺序,不过普通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.
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] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618882682
> > > > > 我这边也有类似的需求,要求单链接严格有序
> > > > > 我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
> > > >
> > > >
> > > > 这个不会呀,InputMessenger 中是 OnNewMessages 来循环处理 socket 的读 event,我现在的处理方式就是在 Parse 阶段完成消息的 decode、process,对于异步处理,会通过 bthread 的 CountdownEvent 来将 bthread 休眠
> >
> >
> > 
> > 我看process也是起一个尽量分配到当前线程的bthread来执行的,以上这一段在socket.cpp里面,由EventDispatcher在收到epoll的触发后调用
>
> 我再看看代码再回复你,不太可能 parse 阶段也会有并发问题,因为 parse 阶段才去读 socket,并发读怎么读消息呢
不好意思,我又读了下代码,这里是用原子量实现的fd粒度的锁
如果ProcessEvent正在读数据,再次ET触发的event取不到原子量不会再开协程,反而是在InputManager阶段又读到了新的数据(pipeline的情况),这样InputManager的锁不会释放反而会一直执行
如果InputManager释放了原子量,证明余下的数据都已经处理完毕了,再次ET触发的event确实应该再开一个ProcessEvent线程
这里似乎设计的很巧妙,第一眼确实没懂
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618879117
> > > > > 我这边也有类似的需求,要求单链接严格有序
> > > > > 我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
> > > >
> > > >
> > > > 这个不会呀,InputMessenger 中是 OnNewMessages 来循环处理 socket 的读 event,我现在的处理方式就是在 Parse 阶段完成消息的 decode、process,对于异步处理,会通过 bthread 的 CountdownEvent 来将 bthread 休眠
> >
> >
> > 
> > 我看process也是起一个尽量分配到当前线程的bthread来执行的,以上这一段在socket.cpp里面,由EventDispatcher在收到epoll的触发后调用
>
> 我再看看代码再回复你,不太可能 parse 阶段也会有并发问题,因为 parse 阶段才去读 socket,并发读怎么读消息呢
我也觉得奇怪,但是https://github.com/apache/incubator-brpc/blob/master/docs/cn/io.md#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.
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] zhijunfu commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
zhijunfu commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-619476256
哦,我就是指的普通的brpc,类似于grpc unary,所以我就这么叫了
我大概理解你的意思了,我记得之前有人问过保序,jamesge的说法是只有stream才能支持,其他的方式都保证不了。在普通的brpc上支持保序不知道改动大不大,估计涉及到brpc内部的一些东西,可能也不太好弄
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618824751
> Parse
参考下这个?在EventDispatch这里会并行Parse哦

你是想找东西换掉EventDispatch?否则如果两个Parse并行还是可能失去顺序啊
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618822086
> > 我这边也有类似的需求,要求单链接严格有序
> > 我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
>
> 这个不会呀,InputMessenger 中是 OnNewMessages 来循环处理 socket 的读 event,我现在的处理方式就是在 Parse 阶段完成消息的 decode、process,对于异步处理,会通过 bthread 的 CountdownEvent 来将 bthread 休眠
也就是说你完全不再用brpc::server、brpc::client嘛,自己轮一个accetper这样的小型轮子?复用socket部分?
我以为你是想要跟redis server那样实现一个新的protocl,在protocl结构体的回调的parse部分完成,因为我看大部分的并发是在调用parse函数执行CutMessage之后并发触发用户重载的回调(就是继承pb类的这个)
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] bailiyang commented on issue #1047: brpc 是否没法保证一个连接上的请求顺序处理?有参数可以控制吗?
Posted by GitBox <gi...@apache.org>.
bailiyang commented on issue #1047:
URL: https://github.com/apache/incubator-brpc/issues/1047#issuecomment-618825824
> > > 我这边也有类似的需求,要求单链接严格有序
> > > 我看socket部分的代码,epoll过来的事件,是按照fd起bthread处理的,如果前一个pipeline特别大,后一个特别小,感觉是有可能在InputManager这里有两个InputManager并发的情况出现,即使都走到Parse这里也可能是并行的Parse
> >
> >
> > 这个不会呀,InputMessenger 中是 OnNewMessages 来循环处理 socket 的读 event,我现在的处理方式就是在 Parse 阶段完成消息的 decode、process,对于异步处理,会通过 bthread 的 CountdownEvent 来将 bthread 休眠
>

我看process也是起一个尽量分配到当前线程的bthread来执行的,以上这一段在socket.cpp里面,由EventDispatcher在收到epoll的触发后调用
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org