You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "kfstorm (via GitHub)" <gi...@apache.org> on 2023/08/07 09:58:19 UTC
[I] stream模式下服务端如何异步处理消息? (brpc)
kfstorm opened a new issue, #2348:
URL: https://github.com/apache/brpc/issues/2348
on_received_messages看起来是个同步函数。如何做到像grpc那样在OnReadDone里处理消息,处理完后自己调用StartRead读取下一条消息?
比如服务端收到消息后需要把消息通过网络转发给另一个服务,如果只能同步处理消息,那么这里就会阻塞线程。如果服务端收到数据后用另一个线程去处理消息,那么就没办法做到反压了。
--
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] stream模式下服务端如何异步处理消息? (brpc)
Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm commented on issue #2348:
URL: https://github.com/apache/brpc/issues/2348#issuecomment-1680465134
把任务放到新bthread,然后bthread_join等待这个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.
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] stream模式下服务端如何异步处理消息? (brpc)
Posted by "kfstorm (via GitHub)" <gi...@apache.org>.
kfstorm commented on issue #2348:
URL: https://github.com/apache/brpc/issues/2348#issuecomment-1677154230
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.
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] stream模式下服务端如何异步处理消息? (brpc)
Posted by "lorinlee (via GitHub)" <gi...@apache.org>.
lorinlee commented on issue #2348:
URL: https://github.com/apache/brpc/issues/2348#issuecomment-1674751754
我理解这个可以自己控制下转发的流速的。Stream的处理是个生产者,另一个线程是个消费者,复制数据这里可以搞个queue,发现堆积就反压生产者,生产者是个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.
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] stream模式下服务端如何异步处理消息? (brpc)
Posted by "lorinlee (via GitHub)" <gi...@apache.org>.
lorinlee commented on issue #2348:
URL: https://github.com/apache/brpc/issues/2348#issuecomment-1670043783
网络转发消息可以走brpc么?走brpc的话就不会阻塞线程了。反压的话可以看下 socket_max_streams_unconsumed_bytes 这个flag
--
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] stream模式下服务端如何异步处理消息? (brpc)
Posted by "kfstorm (via GitHub)" <gi...@apache.org>.
kfstorm commented on issue #2348:
URL: https://github.com/apache/brpc/issues/2348#issuecomment-1670438106
我只是用网络转发消息举例,实际上不是这个场景。总之需求是异步处理stream里的消息。我知道unary rpc是可以异步处理的。
反压的前提是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.
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