Giter Site home page Giter Site logo

apache / incubator-brpc Goto Github PK

View Code? Open in Web Editor NEW
15.9K 814.0 3.9K 38.21 MB

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 "better RPC".

Home Page: https://brpc.apache.org

License: Apache License 2.0

Makefile 0.61% Shell 0.35% C++ 94.25% C 0.50% Objective-C++ 0.29% Objective-C 0.20% CMake 1.55% Python 0.25% Perl 1.36% Thrift 0.01% Dockerfile 0.01% Starlark 0.50% Ruby 0.04% Lua 0.09%
rpc

incubator-brpc's Introduction

中文版

Linux Build Status MacOs Build Status

brpc logo (light) brpc logo (dark)

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 "better RPC".

You can use it to:

Try it!

Contribute code

Please refer to here.

Feedback and Getting involved

Code of Conduct

We follow the code of conduct from Apache Software Foundation, please refer it here Link

incubator-brpc's People

Contributors

372046933 avatar cdjingit avatar chenbright avatar chenzhangyi avatar ehds avatar gongweibao avatar guodongxiaren avatar hiberabyss avatar huixxi avatar ipconfigme avatar jamesge avatar jasonszang avatar leaf-potato avatar lorinlee avatar lrita avatar lzfhust avatar old-bear avatar serverglen avatar stdpain avatar tanzhongyi003 avatar tousakarin avatar tuvie avatar v1siuol avatar wasphin avatar wchengcheng avatar wenweihu86 avatar wwbmmm avatar yanglimingcn avatar yangzhg avatar zyearn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

incubator-brpc's Issues

覆盖阻塞的系统函数是不是可以获得更高并发?

文档中提到拒绝覆盖阻塞系统函数:
2. 和阻塞pthread的函数混用时可能死锁。
3. 这类hook函数本身的效率一般更差
这两个可以理解,但是某些情况下 覆盖后是不是获得更高的并发?
例如覆盖usleep gethostbyname

不是说支持java吗

不是说支持java吗?戈君:brpc于2014年创建,在百度内部称为“baidu-rpc”。到目前为止,brpc一共进行了3000次左右的改动,现在仍在持续优化中,百度内的wiki上可以查询到每次改动的描述。brpc的主要语言是C++和Java,对其他语言的支持主要是通过包装C++版本,比如brpc的Python版包含C++版的大部分功能。

协程支持吗

rpc调用, 即使是多线程, 也比较消耗资源, 如果使用协程切换,就比较有优势了

doc: document should fix version information

r28921之前:如果closewait_ms不会0,且还有请求在被处理,那么Server不会立刻关闭与client的连接,而是继续处理请求,同时对client发来的新请求立刻回复ELOGOFF错误以防止新请求加入,这个过程最多持续closewait_ms毫秒,之后Server会关闭所有连接并退出。

r28921之后:closewait_ms失效,不管它是什么值,server在退出时总会等待所有正在被处理的请求完成,同时对新请求立刻回复ELOGOFF错误。这么做的原因在于只要server退出时仍有处理线程运行,就有访问到已释放内存的风险。如果你的server“退不掉”,很有可能是由于某个检索线程hang住了,

under git version control , can you fix with git version instead of svn version?
many thanks.

使用glog 会导致 ./test_bvar 测试失败

在编译时如果使用glog(--with-log), 会导致test/test_bvar 测试失败;原因好像是框架代码里面使用了 LOG(FATAL) 直接terminate了(test/bvar_variable_unittest.cpp: 69行 对应 bvar/variable.cpp:177行).

多个依赖包路径指定失败

当依赖包存在于多个路径,安装文档指定路径的时候,会报错,提示 readlink: extra operand /usr/include' Try readlink --help' for more information. 请问如何处理

brpc源码交流

对brpc源码感兴趣的同学我们可以一起分模块研究,然后共同share 提升读源的效率~群:498837325

WSL 编译出错

WSL Ubuntu 14.04 编译出现如下错误:

In file included from ./src/brpc/protocol.h:27:0,
                 from ./src/brpc/policy/rtmp_protocol.h:22,
                 from src/brpc/ts.cpp:36:
./src/butil/endpoint.h: In function ‘bool butil::operator>(butil::EndPoint, butil::EndPoint)’:
./src/butil/endpoint.h:169:17: internal compiler error: Segmentation fault
     return p2 < p1;
                 ^
In file included from ./src/butil/intrusive_ptr.hpp:25:0,
                 from ./src/brpc/details/load_balancer_with_naming.h:20,
                 from src/brpc/details/load_balancer_with_naming.cpp:17:
/usr/include/c++/4.8/functional:481:5: internal compiler error: Segmentation fault
     cref(const _Tp& __t) noexcept
     ^
src/brpc/uri.cpp: In member function ‘void brpc::URI::SetHostAndPort(const string&)’:
src/brpc/uri.cpp:381:6: internal compiler error: Segmentation fault
 void URI::SetHostAndPort(const std::string& host) {
      ^
mmap: Cannot allocate memory
mmap: Cannot allocate memory
Please submit a full bug report,
with preprocessed source if appropriate.
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
In file included from /usr/include/c++/4.8/string:52:0,
                 from src/brpc/details/http_message.cpp:20:
/usr/include/c++/4.8/bits/basic_string.h:2977:3: internal compiler error: Segmentation fault
   { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(long),
   ^
In file included from ./src/butil/build_config.h:44:0,
                 from ./src/butil/compiler_specific.h:8,
                 from ./src/butil/macros.h:16,
                 from ./src/butil/basictypes.h:18,
                 from ./src/butil/strings/string_piece.h:37,
                 from ./src/butil/iobuf.h:27,
                 from ./src/brpc/details/hpack.h:20,
                 from src/brpc/details/hpack.cpp:17:
/usr/include/unistd.h:1134:5: internal compiler error: Segmentation fault
     ssize_t __n) __THROW __nonnull ((1, 2));
     ^
make: vfork: Cannot allocate memory
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
The bug is not reproducible, so it is likely a hardware or OS problem.
The bug is not reproducible, so it is likely a hardware or OS problem.
The bug is not reproducible, so it is likely a hardware or OS problem.
The bug is not reproducible, so it is likely a hardware or OS problem.
make: *** [src/brpc/ts.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [src/brpc/uri.o] Error 1
make: *** [src/brpc/details/hpack.o] Error 1
make: *** [src/brpc/details/http_message.o] Error 1
make: *** [src/brpc/details/load_balancer_with_naming.o] Error 1
In file included from ./src/bvar/bvar.h:24:0,
                 from ./src/brpc/details/method_status.h:21,
                 from src/brpc/details/method_status.cpp:19:
./src/bvar/passive_status.h:43:5: internal compiler error: Segmentation fault
     typedef detail::ReducerSampler<PassiveStatus, Tp, detail::AddTo<Tp>,
     ^
In file included from /usr/include/c++/4.8/memory:81:0,
                 from ./src/butil/unique_ptr.h:8,
                 from ./src/brpc/socket_id.h:24,
                 from ./src/brpc/socket_map.h:19,
                 from src/brpc/details/naming_service_thread.cpp:24:
/usr/include/c++/4.8/bits/unique_ptr.h:49:3: internal compiler error: Segmentation fault
   template<typename> class auto_ptr;
   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
make: *** [src/brpc/details/method_status.o] Error 1
The bug is not reproducible, so it is likely a hardware or OS problem.
make: *** [src/brpc/details/naming_service_thread.o] Error 1

Brpc cannot link on Ubuntu LTS 16.04

Linking echo_client
../..//output/lib/libbrpc.a(channel.o): In function std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > butil::class_name_str<brpc::Describable>(brpc::Describable const&)': /home/brpc/brpc/./src/butil/class_name.h:52: undefined reference to butil::demangle(char const*)'
../..//output/lib/libbrpc.a(load_balancer.o): In function std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > butil::class_name_str<brpc::NonConstDescribable>(brpc::NonConstDescribable const&)': /home/brpc/brpc/./src/butil/class_name.h:52: undefined reference to butil::demangle(char const*)'
/home/brpc/brpc/./src/butil/class_name.h:52: undefined reference to butil::demangle(char const*)' ../..//output/lib/libbrpc.a(socket.o): In function std::__cxx11::basic_string<char, std::char_traits, std::allocator > butil::class_name_strbrpc::Describable(brpc::Describable const&)':
/home/brpc/brpc/./src/butil/class_name.h:52: undefined reference to butil::demangle(char const*)' ../..//output/lib/libbrpc.a(socket.o): In function std::__cxx11::basic_string<char, std::char_traits, std::allocator > butil::class_name_strbrpc::SocketUser(brpc::SocketUser const&)':
/home/brpc/brpc/./src/butil/class_name.h:52: undefined reference to butil::demangle(char const*)' ../..//output/lib/libbrpc.a(socket.o):/home/brpc/brpc/./src/butil/class_name.h:52: more undefined references to butil::demangle(char const*)' follow
collect2: error: ld returned 1 exit status
Makefile:34: recipe for target 'echo_client' failed
make: *** [echo_client] Error 1

编译报错

编译时出现错误:
In file included from ./src/butil/basictypes.h:18:0,
from ./src/butil/files/file.h:20,
from src/butil/files/file_posix.cc:5:
src/butil/files/file_posix.cc: In member function ‘int64_t butil::File::Seek(butil::File::Whence, int64_t)’:
./src/butil/macros.h:173:34: error: static assertion failed: off_t_64_bit
#define BAIDU_CASSERT(expr, msg) static_assert(expr, #msg)
^
./src/butil/macros.h:218:36: note: in expansion of macro ‘BAIDU_CASSERT’
#define COMPILE_ASSERT(expr, msg) BAIDU_CASSERT(expr, msg)
^
src/butil/files/file_posix.cc:286:3: note: in expansion of macro ‘COMPILE_ASSERT’
COMPILE_ASSERT(sizeof(int64_t) == sizeof(off_t), off_t_64_bit);
^
make: *** [src/butil/files/file_posix.o] 错误 1

是否支持TLS?

brpc是否支持TLS或其它加密传输层协议?
如何保证传输的安全性呢?

brpc/example/http_c++ Failed to make on ubuntu 16.04

sudo apt-get install git g++ make libssl-dev
sudo apt-get install libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev
sudo apt-get install libsnappy-dev
sudo apt-get install google-perftools libgoogle-perftools-dev
sh config_brpc.sh --headers=/usr/include --libs=/usr/lib

gcc version 5.3.1

Error:
ubuntu:~/brpc/example/http_c++$ make
../..//config.mk:15: *** "Fail to find gperftools". Stop.

README文件中的单词拼写错误

第一个标题下的第四行 :

Fields in the data are added, modified or removed guadually , how do newer services talk with older services?

guadually -> gradually

请问有支持限流和熔断吗?

我看了一下文档和ppt,没有发现限流和熔断功能的相关信息。
如果有的话,有相关资料吗?
如果没有,则你们的考虑是什么?

Funcation names, some are HasFun(), while others are has_fun()

Why are some functions named CamelCase while others are camel_case?

example:
// Whether the underlying channel is using SSL
bool is_ssl() const;

// Resets the Controller to its initial state so that it may be reused in
// a new call.  Must NOT be called while an RPC is in progress.

void Reset() { InternalReset(false); }

does brpc currently have ROADMAP?

Hi, All,

Thanks a lot for Baidu for opensourcing such a valuable project.

I wish to get know that if currently brpc has a ROADMAP?

Thanks a lot.

wakeup_pthread和wait_pthread的疑问

void wakeup_pthread(ButexPthreadWaiter* pw) {
    // release fence makes wait_pthread see other changes when it sees new sig
    pw->sig.store(SAFE_TO_DESTROY, butil::memory_order_release);
    // At this point, *pw is possibly destroyed if wait_pthread has woken up and
    // seen the new sig. As the futex_wake_private just check the accessibility
    // of the memory and returnes EFAULT in this case, it's just fine.
    // If crash happens in the future, we can make pw as tls and never
    // destroyed to resolve this issue.
    futex_wake_private(&pw->sig, 1);
}

int wait_pthread(ButexPthreadWaiter& pw, timespec* ptimeout) {
    int expected_value = NOT_SIGNALLED;
    while (true) {
        const int rc = futex_wait_private(&pw.sig, expected_value, ptimeout);
        // Accquire fence makes this thread sees other changes when it sees
        // the new |sig|
        if (expected_value != pw.sig.load(butil::memory_order_acquire)) {
            // After this routine returns, |pw| will be destroyed while the wake
            // thread possibly still uses it. See the comments in wakeup_pthread
            return rc;
        }
     .........
    }
}

挂起的pthread从futex_wait_private中返回是在wakeup_pthread调用futex_wake_private之后(或者超时),为什么wakeup_pthread还会出现下面这种情况?

// At this point, *pw is possibly destroyed if wait_pthread has woken up and
    // seen the new sig. As the futex_wake_private just check the accessibility
    // of the memory and returnes EFAULT in this case, it's just fine.
    // If crash happens in the future, we can make pw as tls and never
    // destroyed to resolve this issue.

bthread调试段错误

写了一个非常简单程序来研究bthread:

#include <bthread/bthread.h>
#include <iostream>

void * work(void *arg)
{
    uint64_t p = reinterpret_cast<uint64_t>(arg);
    std::cout << p << std::endl;
    return 0;
}

int main()
{
    bthread_t bt;
    bthread_start_urgent(&bt, nullptr, work, (void *)128);
    void *ret;
    bthread_join(bt, &ret);
    return 0;
}

直接运行没有问题,但是用gdb进行调试时,进入bthread_start_urgent函数后,一旦执行 bthread::TaskGroup* g = bthread::tls_task_group; 就段错误,不知道是什么原因,希望大神指点。

环境:

[abs@abs brpc]$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

[abs@abs brpc]$ uname -a
Linux abs 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

BENCHMARK中对Latency的定义是什么

刚看了Benchmark的数据,想问下latency的值是怎么一个计算方式,是从用户的调用开始->用户收到响应结果这个时间差么?包含了所有的编解码与网络传输及业务逻辑处理的时间么?

make error

Makefile:2: config.mk: 没有那个文件或目录
/bin/sh: 第 0 行:test: -ge: 期待一元表达式
/bin/sh: 第 0 行:test: -ge: 期待一元表达式
make: *** 没有规则可以创建目标“config.mk”。 停止。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.