Instructions for using Pebble, a distributed development framework

Introduction

Pebble is positioned as an easy-to-use, reliable, high-performance, and easily extensible distributed development framework that supports multiple usage methods:

  • Use the full pebble framework
  • Use each pebble submodule independently
  • Embed pebble frames in other frames.

Pebble has good scalability and can be easily extended to connect to existing systems. Based on this framework, developers only need to focus on the implementation of business logic, and do not need to focus on the development of basic functions, such as network communication, data storage, cluster management, etc. Using pebble's supporting operating system, you can easily perform operations such as game open area server opening, version upgrade, capacity expansion and shrinkage.

Function

  • Communication: A message-based communication interface is provided. By default, it comes with a TCP/UDP network library. Users can easily connect to other network libraries or message queue services.

  • Service management: With the service management function, the client can communicate without manually configuring the address of the server. Each service (service) has a unique name, the service consists of a set of specific functions, and each server process can manage multiple services. Pebble provides a name service interface. Using the Pebble framework, the server can easily register the service address with the name server, and the client can easily pull the address information of the service from the name server. We provide a reference implementation of the ZooKeeper -based name service, and users can easily extend their own name service.

  • Cluster management: Based on Zookeeper's name service implementation, after the service process is started, it will automatically maintain a heartbeat with ZooKeeper. The client will periodically obtain the server-side address information from ZooKeeper. Once the service process fails, the client will automatically remove it from the service list. The same is true for adding service processes. Thus, the cluster state management can be conveniently realized, and the server can be easily expanded and reduced.

  • RPC: Supports both Thrift and ProtoBuf IDLs, consistent RPC programming interface, supports synchronous, asynchronous, and parallel calls, and users can easily expand to support other IDLs.

  • Coroutines: Coroutines can reduce the complexity of asynchronous code, make the code look synchronous, and have asynchronous performance at the same time. The development framework integrates the functions of coroutines well, and RPC service processing is in a coroutine by default. When the server receives the RPC request from the client, the system will automatically create a coroutine for you, please be careful not to call blocking operations. If a blocking operation is to be called, it needs to be modified to be called as a coroutine, otherwise the processing capability of the entire server will be affected.

  • Broadcasting: Broadcasting is a common requirement for gaming businesses. Pebble supports broadcasting between servers on the server side, as well as broadcasting between multiple servers and multiple mobile clients. Whether it is a mobile client or a background server, as long as everyone joins the same channel, they can respond to all requests. The broadcast function is implemented on the basis of RPC, so its programming experience is consistent with RPC.

  • Process Framework: It is a single-threaded development framework that integrates the above functions. Built-in statistics reporting, overload protection, control commands and other functions, using our framework, only need to call a small number of interfaces, you can quickly develop a game background server.

  • Supporting tools: It comes with a control command tool, which is convenient for centralized operation, maintenance and debugging.

Source address: https://github.com/Tencent/Pebble

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324885872&siteId=291194637