Giter VIP home page Giter VIP logo

pebble's Introduction

项目目前是存档状态,感谢您对腾讯开源项目的关注!您可以继续fork后更新迭代,感谢理解和支持;如果您有其他疑问,建议请发送邮件:[email protected] 与我们联系


分布式开发框架Pebble使用说明


简介

Pebble定位为一个好用、可靠、高性能、易扩展的分布式开发框架,支持多种使用方式:

  • 使用完整的pebble框架
  • 独立使用各pebble子模块
  • 在其他框架中嵌入pebble框架。

Pebble具备良好的扩展性,可非常方便的扩展对接现有系统。基于该框架,可以让开发者只需专注于业务逻辑的实现,而不需要关注基础功能的开发,如网络通信,数据存储,集群管理等。使用pebble配套的运营系统,可方便的进行游戏开区开服,版本升级,扩容缩容等操作。

功能

  • 通信:提供了基于消息的通信接口,默认自带TCP/UDP网络库,用户可方便的对接到其他网络库或消息队列服务。

  • 服务管理:有了服务管理功能,客户端无需手工配置服务器端的地址即可通信。每一个服务(service)都有一个唯一的名字,服务由一组具体的函数组成,每个服务器进程可以管理多个服务。Pebble提供了名字服务接口,使用Pebble框架,服务端可方便的将服务地址注册到名字服务器,客户端可以方便的从名字服务器拉取到服务的地址信息。我们提供了基于ZooKeeper的名字服务参考实现,用户也可以很方便的扩展自己的名字服务。

  • 集群管理:基于Zookeeper的名字服务实现,服务进程启动后,会自动与ZooKeeper之间维持心跳。客户端会定时从ZooKeeper获取服务器端的地址信息,一旦服务进程故障,客户端会自动将其从服务列表中去除。同理,增加服务进程也是一样。从而可方便的实现集群状态管理,可方便的对服务器进行扩容和缩容。

  • RPC:同时支持Thrift和ProtoBuf两种IDL,一致的RPC编程接口,支持同步、异步、并行调用,用户可以很方便的扩展支持其他IDL。

  • 协程:协程可降低异步代码的复杂度,让代码看起来像同步一样,同时具有异步的性能。开发框架很好的集成了协程的功能,RPC服务处理默认在一个协程里面。当服务器端收到客户端的RPC请求时,系统会自动为你创建协程,请注意不要调用阻塞操作。如果要调用阻塞操作,需要将其修改为以协程的方式调用,否则整个server的处理能力会受到影响。

  • 广播:广播是游戏业务的一个常见需求。pebble支持服务器端server之间的广播,也支持多服务器与多手机客户端之间的广播。无论是手机客户端还是后台服务器,只要大家加入一个相同的频道(channel),就可以做到一呼百应。广播功能是在RPC的基础上实现,所以它的编程体验与RPC是一致的。

  • 进程框架:它是一个单线程的开发框架,集成了上述功能。内置统计上报、过载保护、控制命令等功能,使用我们的框架,只需要调用少量接口,即可快速开发出游戏后台server。

  • 配套工具:自带了控制命令工具,方便集中运维与调试。

技术交流

QQ群:231407428


Copyright ©1998 - 2015 Tencent. All Rights Reserved.

腾讯公司 版权所有

pebble's People

Contributors

chexiongsheng avatar tatezhang avatar tencent-adm 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

pebble's Issues

编译错误

cd build64_release/source/rpc;cp ../broadcast/libpebble_broadcast.a .;cp ../../thirdparty/consistent_hash/libconsistent_hash.a .;ar -x libpebble_broadcast.a;ar -x libconsistent_hash.a;ar -x common/libpebble_rpc_common.a;ar -x protocol/libpebble_rpc_protocol.a;ar -x transport/libpebble_rpc_transport.a;ar -x libpebble_rpc.a;ar -rcs libpebble_rpc_s.a *.o;rm *.o;rm libpebble_broadcast.a;rm libconsistent_hash.a
build64_release/source/rpc/compiler/cpp/src/pebble -r -out build64_release/tutorial/helloworld --gen cpp tutorial/helloworld/helloworld.pebble
Compiling build64_release/tutorial/broadcast/idl/broadcast_tutorial_BroadcastTrigger.cpp
cp: cannot stat '../../thirdparty/consistent_hash/libconsistent_hash.a': No such file or directory
ar: libconsistent_hash.a: No such file or directory
rm: cannot remove 'libconsistent_hash.a': No such file or directory

缺少库啊,编译错误

框架使用

看了example下的例子,有几点使用上的疑惑

  1. 我目前熟悉的游戏大致流程如下
                     |<--->serviceA
player<->gateway<--->|<--->serviceB
                     |<--->serviceC
  1. 看了pebble的例子,我所理解的是client可以当做player,server可以当做serviceX,
    我如何实现一个gateway来转发client与serviceX的中间层呢

关于broadcastMgr 的疑问

我看了项目中的broadcastMgr,是采用的订阅者的模式,服务器采用循环TCP发送的方式,向订阅者发送订阅数据;
那么可否实现,一条数据只向订阅组发送一次,达到所有订阅者都能接收到的方式;类似UDP broadcast一样;如果这种方式实现的话,是否会优于目前的方式?如果没有好处,那么原因是什么呢?

编译错误

build64_release/src/common/libpebble_common.a(thread.cpp.o): In function pebble::Thread::Start()': /home/Pebble-master/src/common/thread.cpp:34: undefined reference to pthread_create'

编译protobuf_rpc时,链接报undefined reference错误

我编译protobuf_rpc时,链接报undefined reference错误,具体如下:
Compiling tools/compiler/pb/src/cpp_plugin.cpp
Linking Program build64_release/tools/compiler/pb/protobuf_rpc
build64_release/tools/compiler/pb/protobuf_rpc.objs/src/cpp_plugin.cpp.o: In function `pebble::ProtoBufPrinter::Print(std::map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::less<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > > const&, char const*)':

/home/jeffxie/work/c++/Pebble/tools/compiler/pb/src/cpp_plugin.cpp:112: undefined reference to `google::protobuf::io::Printer::Print(std::map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::less<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > > const&, char const*)'

build64_release/tools/compiler/pb/protobuf_rpc.objs/src/cpp_plugin.cpp.o: In function `pebble::ProtoBufPrinter::ProtoBufPrinter(std::__cxx11::basic_string<char, std::char_traits, std::allocator >*)':

/home/jeffxie/work/c++/Pebble/tools/compiler/pb/src/cpp_plugin.cpp:109: undefined reference to `google::protobuf::io::StringOutputStream::StringOutputStream(std::__cxx11::basic_string<char, std::char_traits, std::allocator >*)'

collect2: error: ld returned 1 exit status
scons: *** [build64_release/tools/compiler/pb/protobuf_rpc] Error 1
scons: building terminated because of errors.
Blade(error): building failure

是不是thirdparty/protobuf/lib64_release没有提供最新的库导致?请大神们指点!谢谢!

编译出错

cc1plus: error: deps/tsf4g/include: No such file or directory [-Werror=missing-include-dirs]
少了tf4g的库

solution to compilation failure under ubuntu 16.04

I failed to compile the project in an ubuntu 16.04 docker following the guideline. The following solution worked for me.

  1. apt-get install libreadline-dev && chmod 775 /root/bin/blade
  2. Edit example/threadpool/BUILD. Change
        '#pthread'
        '//src/common/:pebble_common',

to

        '//src/common/:pebble_common',
        '#pthread'
  1. There are two linkage errors with the provided protobuf libraries. Installing the official version solved the problem.
  • Download it from the official repo and install it following the guideline
  • ldconfig
  • Edit tools/compiler/pb/BUILD. Change
    deps = [
        '//src/common:pebble_common',
        '//thirdparty/protobuf:protoc',
    ]

to

    deps = [
        '#protoc',
        '#protobuf',
        '//src/common:pebble_common',
    ]

Now it compiles.

能留个联系方式么

能留个联系方式么,或建个QQ群来讨论pebble, pebble rpc 规则文档都木有上传!!!!我的QQ445267987

服务端-服务端间rpc同步调用报错

例如服务A 有一个接口a,在访问A::a时,会rpc调用服务B上的接口b,使用协程应该怎么写呢?

A::a(const ARequest& request, cxx::function<void(int32_t ret_code, const AResponse& response)>& rsp){
  BRequest b_req;
  BResponse b_resp;
  b_client.b(b_req, &b_resp);
  AResponse a_resp;
  // xxxxxx
  rsp(pebble::kRPC_SUCCESS, a_resp);
}

这样会报错
[(src/server/pebble_server.cpp:714)(ProcessMessage)][ERROR] handle(4294967298) not attach a processor remote(4294967298)
[(src/framework/net_message.cpp:766)(RecvTcpData)][ERROR] recv failed(-1:), netaddr=4294967297

编译缺少libconsistent_hash.a库文件

编译环境:
腾讯云机器
centos7.2
gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

请问能建立一个pebble的交流群吗,出现问题方便及时沟通。谢谢~

编译错误信息:
build64_release/source/rpc/compiler/cpp/src/pebble -r -out build64_release/tutorial/helloworld --gen cpp tutorial/helloworld/helloworld.pebble
cd build64_release/source/rpc;cp ../broadcast/libpebble_broadcast.a .;cp ../../thirdparty/consistent_hash/libconsistent_hash.a .;ar -x libpebble_broadcast.a;ar -x libconsistent_hash.a;ar -x common/libpebble_rpc_common.a;ar -x protocol/libpebble_rpc_protocol.a;ar -x transport/libpebble_rpc_transport.a;ar -x libpebble_rpc.a;ar -rcs libpebble_rpc_s.a *.o;rm *.o;rm libpebble_broadcast.a;rm libconsistent_hash.a
cp: cannot stat '../../thirdparty/consistent_hash/libconsistent_hash.a': No such file or directory
ar: libconsistent_hash.a: No such file or directory
rm: cannot remove 'libconsistent_hash.a': No such file or directory
scons: *** [build64_release/source/rpc/libpebble_rpc_s.a] Error 1
scons: building terminated because of errors.
Blade(error): building failure

编译有一个错误

Blade(warning): Auto upgrade failure: /root/bin/blade: line 75: svn: command not found
Blade(warning): Please svn up /mnt/git_project/Pebble/tools/blade
Blade(warning): You can setenv BLADE_AUTO_UPGRADE=no to disable auto upgrade
Blade(info): loading BUILDs...
Blade(info): loading done.
Blade(info): analyzing dependency graph...
Blade(info): analyzing done.
Blade(info): generating build rules...
sh: 1: svn: not found
Blade(info): CPP=cpp
Blade(info): CC=gcc
Blade(info): CXX=g++
Blade(info): NVCC=nvcc
Blade(info): LD=g++
Blade(info): generating done.
Blade(info): tunes the parallel jobs number(-j N) to be 2
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build64_release
Updating version information
Compiling source/rpc/compiler/cpp/src/main.cc
Compiling source/rpc/compiler/cpp/src/thrifty.cc
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-4.8/README.Bugs for instructions.
scons: *** [build64_release/source/rpc/compiler/cpp/src/pebble.objs/main.cc.o] Error 4
thrifty.yy:28:0: warning: "__STDC_LIMIT_MACROS" redefined [enabled by default]
:0:0: note: this is the location of the previous definition
thrifty.yy:29:0: warning: "__STDC_FORMAT_MACROS" redefined [enabled by default]
:0:0: note: this is the location of the previous definition
{standard input}: Assembler messages:
{standard input}:5661: Warning: end of file not at end of a line; newline inserted
{standard input}:6328: Error: unknown pseudo-op: `.lvl5'
{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-4.8/README.Bugs for instructions.
scons: *** [build64_release/source/rpc/compiler/cpp/src/pebble.objs/thrifty.cc.o] Error 4
scons: building terminated because of errors.
Blade(error): building failure

请问这个是什么问题

编译报错,请指教

Blade(warning): Auto upgrade failure: 跳过“tools/blade”
svn: E155007: None of the targets are working copies
Blade(warning): Please svn up /home/Test/文档/Pebble-master/tools/blade
Blade(warning): You can setenv BLADE_AUTO_UPGRADE=no to disable auto upgrade
Blade(warning): unknown source client type, NOT svn OR git
Blade(info): loading BUILDs...
Blade(error): //./BUILD not found, exit...

进程号大于102400时会发生段错误

文件src/common/coroutine.cpp 中定义数组
static stCoRoutineEnv_t* g_arrCoEnvPerThread[102400] = {0};

在函数coroutine_open()中直接使用pid作为下标,有可能导致数组下标越界错误。
虽然进程pid小于102400的概率比较小,但我确实遇到了。

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.