brpc
brpc copied to clipboard
brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means...
在异步的服务端代码中,我们把请求入口处的done对象保存了下来。再之后某个时间,请求处理完成后,再调用done->Run()。 显然,在请求入口的时候,代码是在bthread中运行的。但是假如我们在异步服务的实现中,保证调用done->Run()的环境一定不是bthread,那么该调用是否会有潜在的调用会在bthread中运行呢?更具体来说,是HttpResponseSenderAsDone::Run()的调用。 更具体来说,现在我们的代码会在pthread中(一个和brpc无关的独立线程池)调用done->Run(),但是调用的时候获取到了一个互斥锁,且该互斥锁不是butex。而该服务所有的rpc请求在刚刚开始处理的时候也会尝试获取相同的互斥锁(这时候代码是在bthread中运行的)。如果即使是pthread中调用done->Run()也可能请求到bthread。那么我们现在这样的逻辑会有死锁风险。详情如下: 1. pthread获取到了mutex,然后即将调用done->Run()。 2. 有大量新请求到达,所有的bthread worker都去处理这些新的请求了,然后因为在bthread中尝试获取mutex,导致所有的bthread worker被阻塞。 3. pthread开始调用done->Run(),在这过程中又去请求bthread,因为bthread worker全被阻塞了,于是触发死锁。 但如果pthread中调用done->Run()不会请求bthread,则死锁不会发生,以上逻辑是安全的。 请帮我核实在pthread中调用done->Run()是否会请求到bthread呢?或者说,brpc在发送回复时,是否有逻辑一定会在bthread上运行,即使done->Run()是在pthread里调用的?
**Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)** **Describe the solution you'd like (描述你期望的解决方法)** 现在brpc监听的都是socket fd,对于socket fd的处理都是OnNewMessages。有时候我们的服务需要监听一些其它类型的文件描述符,比如eventfd,然后通过eventfd来做一些逻辑,OnNewEvents。这块能否做一些扩展呢?让用户能向EventDispatcher注册这些fd并且实现自己的事件处理CallBack。 实现上,可能可以加一个Socket::DummyCreate(const SocketOptions& options, SocketId* id),SocketOptions里面填入自己的on_edge_triggered_events CallBack和对应的eventfd **Describe alternatives you've considered (描述你想到的折衷方案)** **Additional...
**Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)** 当前 brpc 代码默认使用的 C++ 标准为 11,不支持 align new (since c++17 https://en.cppreference.com/w/cpp/memory/new/operator_new) . 如果某个 class 指定了 alignment 要求(例如 BAIDU_CACHELINE_ALIGNMENT),代码中使用 new 的方式来分配其对象时,地址有可能并不是严格按照其对齐方式的。 >...
### What problem does this PR solve? Issue Number: #2416 Problem Summary: ### What is changed and the side effects? Changed: Side effects: - Performance effects(性能影响): - Breaking backward compatibility(向后兼容性):...
**Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)** 我在实验 streaming rpc 的过程当中发现仿佛内置服务无法监控通过streamwrite发送的请求?或者说也许我找错了地方 请指教 **Describe the solution you'd like (描述你期望的解决方法)** **Describe alternatives you've considered (描述你想到的折衷方案)** **Additional context/screenshots (更多上下文/截图)**
**Describe the bug (描述bug)** 基于官方文档开始编译brpc https://github.com/apache/brpc/blob/master/docs/cn/getting_started.md#%E4%BD%BF%E7%94%A8cmake%E7%BC%96%E8%AF%91brpc 使用的是yum install安装的相关依赖,虽然可能会有版本很旧的情况,但是操作流程是按照官方文档来的。 **To Reproduce (复现方法)** 直接按照官方文档一步一步操作即可,在不同电脑的centos虚拟机上,必定出现同样的问题。都是在同一个位置报段错误,但是同样的代码在unbuntu上可以通过,说明肯定不是代码的问题 **Expected behavior (期望行为)** 正常编译通过。 事实上我在ubuntu16.04.07机器上按照官方文档的说明进操作,最后编译成功了,但是在centos7上始终卡在对应的问题上。 **Versions (各种版本)** OS:[CentOS-7-x86_64-DVD-2009.iso](https://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso) Compiler:gcc 4.8.5 5.4.0 8.3.0 都尝试过 brpc: master分支,release-1.6.0, release-1.5.0都尝试过 protobuf: yum...
**Describe the bug (描述bug)** 自己写了一个[测试](https://github.com/binarycopycode/brpc_rdma_tcp_perf)rdma和tcp速度差别的小测试,自己测试了128,256,512Mb都没问题。当传输大小为1G的数据时,rdma无任何报错,但是client接收到的attachment().size()是0,而使用tcp传输大小为1G的数据时,则出现报错 ``` W1220 15:39:25.600674 5980 /home/binarycopycode/work/brpc_rdma_tcp_perf/src/brpc/input_messenger.cpp:375] Fail to read from Socket{id=102 fd=9 addr=192.168.182.129:40614:8011} (0x7f0d58026820): Connection reset by peer W1220 15:39:25.600733 5980 /home/binarycopycode/work/brpc_rdma_tcp_perf/src/brpc/socket.cpp:1774] Fail to keep-write into...
**Describe the bug (描述bug)** --第一个class struct data{ ..... } class DemoTask { public: bthread::ExecutionQueueId queue_id_one; void start(){ bthread::execution_queue_start(&queue_id_one, nullptr, insertMongoDB, nullptr); } }; int consume(void* meta, TaskIterator& iter) { if...
**Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)** https://github.com/apache/brpc/pull/1996 **Describe the solution you'd like (描述你期望的解决方法)** The mentioned PR enabled using bRPC as a third party dependency but it is...
**Describe the bug (描述bug)** 请教一下,下游n个server一致性哈希。上游能否使用stream rpc连接dynamic pattition channel,并且在切换连接是stream rpc应用层能感知到,并且能够重新发起握手RPC? **To Reproduce (复现方法)** **Expected behavior (期望行为)** **Versions (各种版本)** OS: Compiler: brpc: protobuf: **Additional context/screenshots (更多上下文/截图)**