All Projects → zhu327 → Doge

zhu327 / Doge

Licence: apache-2.0
Doge is a high-performance, Python based, open source RPC framework

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Doge

Whatsmars
Java生态研究(Spring Boot + Redis + Dubbo + RocketMQ + Elasticsearch)🔥🔥🔥🔥🔥
Stars: ✭ 1,389 (+864.58%)
Mutual labels:  microservices, rpc, rpc-framework
Jupiter
Jupiter是一款性能非常不错的, 轻量级的分布式服务框架
Stars: ✭ 1,372 (+852.78%)
Mutual labels:  rpc, rpc-framework, service-discovery
Armeria
Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
Stars: ✭ 3,392 (+2255.56%)
Mutual labels:  microservices, rpc, rpc-framework
Rsf
已作为 Hasor 的子项目,迁移到:http://git.oschina.net/zycgit/hasor
Stars: ✭ 77 (-46.53%)
Mutual labels:  rpc, rpc-framework, service-discovery
Rpcx
Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱!
Stars: ✭ 6,516 (+4425%)
Mutual labels:  microservices, rpc, service-discovery
Spring Cloud Cloudfoundry
Integration between Cloudfoundry and the Spring Cloud APIs
Stars: ✭ 83 (-42.36%)
Mutual labels:  microservices, service-discovery
Microservice Patterns
Code to share the knowledge I gained while designing and implementing micro services
Stars: ✭ 87 (-39.58%)
Mutual labels:  microservices, service-discovery
Rpc.py
A fast and powerful RPC framework based on ASGI/WSGI.
Stars: ✭ 98 (-31.94%)
Mutual labels:  rpc, rpc-framework
Hprose Golang
Hprose is a cross-language RPC. This project is Hprose for Golang.
Stars: ✭ 1,143 (+693.75%)
Mutual labels:  rpc, rpc-framework
Hprose Delphi
Hprose is a cross-language RPC. This project is Hprose 2.0 for Delphi and FreePascal
Stars: ✭ 100 (-30.56%)
Mutual labels:  rpc, rpc-framework
Simple Rpc
RPC with service discovery base on netty
Stars: ✭ 103 (-28.47%)
Mutual labels:  rpc, service-discovery
Easyrpc
EasyRpc is a simple, high-performance, easy-to-use RPC framework based on Netty, ZooKeeper and ProtoStuff.
Stars: ✭ 79 (-45.14%)
Mutual labels:  rpc, rpc-framework
Purerpc
Asynchronous pure Python gRPC client and server implementation supporting asyncio, uvloop, curio and trio
Stars: ✭ 125 (-13.19%)
Mutual labels:  rpc, rpc-framework
Gotree
Gotree is a vertically distributed framework. Gotree's goal is to easily develop distributed services and liberate the mental burden of developers.
Stars: ✭ 91 (-36.81%)
Mutual labels:  rpc, rpc-framework
Rpcx Java
rpcx implementation in Java for server side and client side
Stars: ✭ 71 (-50.69%)
Mutual labels:  rpc, rpc-framework
Nirum
Nirum: IDL compiler and RPC/distributed object framework for microservices
Stars: ✭ 119 (-17.36%)
Mutual labels:  microservices, rpc
Hprose Js
Hprose is a cross-language RPC. This project is Hprose 2.0 RPC for JavaScript
Stars: ✭ 133 (-7.64%)
Mutual labels:  rpc, rpc-framework
Raptor
拍拍贷微服务rpc框架
Stars: ✭ 139 (-3.47%)
Mutual labels:  microservices, rpc
Sample Vertx Microservices
Two applications in different branches illustrates how to create asynchronous microservices with Vert.x, Consul and MongoDB, and how to secure them with Vert.x OAuth2 module and Keycloak
Stars: ✭ 37 (-74.31%)
Mutual labels:  microservices, service-discovery
Spyne
A transport agnostic sync/async RPC library that focuses on exposing services with a well-defined API using popular protocols.
Stars: ✭ 992 (+588.89%)
Mutual labels:  rpc, rpc-framework

Doge

License Build Status codecov codebeat badge

Doge is a Python RPC framework like Alibaba Dubbo and Weibo Motan.

Features

doge

  • 服务治理, 服务注册, 服务发现
  • 高可用策略, failover, backupRequestHA
  • 负载均衡策略, RandomLB, RoundrobinLB
  • 限流策略, gevent Pool
  • 功能扩展, Opentracing, Prometheus

Quick Start

Installation

pip install dogerpc

你可以在examples找到以下实例

Doge server

  1. 新建server端配置文件
registry:  # 注册中心
  protocol: etcd  # 注册协议, 支持 etcd 与 direct, 默认 etcd
  host: 127.0.0.1  # 注册中心 host
  port: 2379  # 注册中心 port
  # "address": "127.0.0.1:2379,127.0.0.1:4001",  # 注册中心地址, 如果有etcd集群, 可配置多个node
  ttl: 10  # etcd注册ttl, 用于server的心跳检查, 默认10s
service:
  name: test  # 服务名称
  node: n1  # 节点名称
  host: 127.0.0.1  # 服务暴露ip
  port: 4399  # 服务暴露port
  limitConn: 100  # 服务最大连接数, 可选, 默认不限制
  filters:  # 服务端扩展中间件
    - doge.filter.tracing.TracingServerFilter  # opentracing
    - doge.filter.metrics.MetricsServerFilter  # prometheus
  1. 定义RPC methods类, 启动服务
# coding: utf-8

from gevent import monkey
monkey.patch_socket()  # 依赖gevent

import logging
logging.basicConfig(level=logging.DEBUG)

from doge.rpc.server import new_server


# 定义rpc方法类
class Sum(object):
    def sum(self, x, y):
        return x + y


if __name__ == '__main__':
    server = new_server('server.yaml')  # 基于配置文件实例化server对象
    server.load(Sum)  # 加载暴露rpc方法类
    server.run()  # 启动服务并注册节点信息到注册中心

Doge client

  1. 新建client端配置文件
registry:  # 注册中心
  protocol: etcd  # 注册协议, 支持 etcd 与 direct, 默认 etcd
  host: 127.0.0.1  # 注册中心 host
  port: 2379  # 注册中心 port
  # "address": "127.0.0.1:2379,127.0.0.1:4001",  # 注册中心地址, 如果有etcd集群, 可配置多个node
  ttl: 10  # etcd注册ttl, 用于server的心跳检查, 默认10s
refer:
  haStrategy: failover  # 高可用策略, 支持 failover backupRequestHA, 默认failover
  loadBalance: RoundrobinLB  # 负载均衡策略, 支持 RandomLB RoundrobinLB, 默认RoundrobinLB
  filters:  # 客户端扩展中间件
    - doge.filter.tracing.TracingClientFilter  # opentracing
    - doge.filter.metrics.MetricsClientFilter  # prometheus
  1. 创建client并call远程方法
# coding: utf-8

from __future__ import print_function

from gevent import monkey
monkey.patch_socket()

import logging
logging.basicConfig(level=logging.DEBUG)

from doge.rpc.client import Cluster

if __name__ == '__main__':
    cluster = Cluster('client.yaml')  # 基于配置文件实例化Cluster对象
    client = cluster.get_client("test")  # 获取服务名对应的Client对象
    print(client.call('sum', 1, 2))  # 远程调用服务Sum类下的sum方法

Doge filter

filter是Doge提供的自定义中间件扩展机制, 当前提供了jaeger链路跟踪与Prometheus的metrics, filter分为客户端filter与服务端filter, 具体的实例可以参考filter目录下的tracing.py

Metrics

在使用Prometheus监控时, 需要在服务节点上配置环境变量prometheus_multiproc_dir用于存储Gunicorn启动多进程时的metrics数据, 然后在服务节点启动Prometheus Python Exporter

https://gist.github.com/zhu327/56cdb58a21a750fb5ca5ae7ccd3e0112

如何在多进程下使用Prometheus参考这里

Doge json gateway

基于Bottle实现的json rpc gateway

https://gist.github.com/zhu327/24c8262dc40c5de7eeaddbfc572f4215

Gunicorn server

创建app.py, 沿用example中的配置文件server.json

# coding: utf-8

from doge.rpc.server import new_server


# 定义rpc方法类
class Sum(object):
    def sum(self, x, y):
        return x + y


server = new_server('server.yaml')  # 基于配置文件实例化server对象
server.load(Sum)  # 加载暴露rpc方法类

创建configs.py, 填写的bind必须与server.yaml配置的监听端口一致

from doge.gunicorn.configs import *

bind = "127.0.0.1:4399"

启动Gunicorn

gunicorn app:server -c configs.py

Requirements

License

Apache License, Version 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].