Code Monkey home page Code Monkey logo

rpcx-framework's Introduction

RPCX Framework

Go Report Card MIT license Build Status Foundation GoDoc Sourcegraph Release TODOs goproxy.cn

An RPC microservices framework based on rpcx.

Features: simple and easy to use, ultra fast and efficient, powerful, service discovery, service governance, service layering, version control, routing label registration.

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!

Java有Dubbo, Golang有RPCX!

Installation

To install rpcx-framework package, you need to install Go and set your Go workspace first.

  1. The first need Go installed (version 1.11+ is required), then you can use the below Go command to install rpcx-framework.
$ go get -u github.com/ZYallers/rpcx-framework
  1. Import it in your code:
import "github.com/ZYallers/rpcx-framework" 

Examples

The below is a simple example.

package main

import (
	"github.com/smallnest/rpcx/log"
	framework "gitlab.sys.hxsapp.net/hxs/rpcx-framework"
)

func init() {
	framework.LoadConfig()
}

func main() {
	//share.Trace = true
	s := framework.NewService()
	log.Infof("Service-> %+v; Etcd-> %+v", *s, *(s.Etcd))
	s.Serve()
}

How to deploy and run?

Copy the boot script "script / bootstrap. Sh" to the root directory of your project, and then execute it; If successful, you will see the following information:

 current path: /Users/cloud/gopath_hxsapp/rpcx-demo 
 download produce.sh 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7791  100  7791    0     0    221      0  0:00:35  0:00:35 --:--:--  1904
 download produce.sh(/Users/cloud/gopath_hxsapp/rpcx-demo/./bin/produce.sh) finished 
 service config: 
 ServiceName: rpcx-demo 
 ServiceAddr: 172.18.28.123:8978 
 LogDir: /apps/logs/go/rpcx-demo 
 Operation: 
     status                                  View service status
     sync                                    Synchronization service vendor resources
     build                                   Compile and generate service program
     reload                                  Smooth restart service
     quit                                    Stop service
     help                                    View help information for the help command
 For more information about an action, use the help command to view it

At the same time, after successful execution, it will create a new bin directory in your current directory, and generate a service compilation and deployment script produce sh

Execute the deployment script ./bin/produce.sh help, it will tell you what to do next.

 service config: 
 ServiceName: rpcx-demo 
 ServiceAddr: 172.18.28.123:8978 
 LogDir: /apps/logs/go/rpcx-demo 
 Operation: 
     status                                  View service status
     sync                                    Synchronization service vendor resources
     build                                   Compile and generate service program
     reload                                  Smooth restart service
     quit                                    Stop service
     help                                    View help information for the help command
 For more information about an action, use the help command to view it

Feature

An RPC service framework based on rpcx (fast, easy-to-use but powerful RPC service governance framework of go language).

  • easy to use
  • super fast and efficient
  • powerful
  • service discovery
  • service governance
  • service layering
  • version control
  • routing label registration.

RPCX

rpcx is a RPC framework like Alibaba Dubbo and Weibo Motan.

rpcx is created for targets:

  1. Simple: easy to learn, easy to develop, easy to intergate and easy to deploy
  2. Performance: high perforamnce (>= grpc-go)
  3. Cross-platform: support raw slice of bytes, JSON, Protobuf and MessagePack. Theoretically it can be used with java, php, python, c/c++, node.js, c# and other platforms
  4. Service discovery and service governance: support zookeeper, etcd and consul.

It contains below features

  • Support raw Go functions. There's no need to define proto files.
  • Pluggable. Features can be extended such as service discovery, tracing.
  • Support TCP, HTTP, QUIC and KCP
  • Support multiple codecs such as JSON, Protobuf, MessagePack and raw bytes.
  • Service discovery. Support peer2peer, configured peers, zookeeper, etcd, consul and mDNS.
  • Fault tolerance:Failover, Failfast, Failtry.
  • Load banlancing:support Random, RoundRobin, Consistent hashing, Weighted, network quality and Geography.
  • Support Compression.
  • Support passing metadata.
  • Support Authorization.
  • Support heartbeat and one-way request.
  • Other features: metrics, log, timeout, alias, circuit breaker.
  • Support bidirectional communication.
  • Support access via HTTP so you can write clients in any programming languages.
  • Support API gateway.
  • Support backup request, forking and broadcast.

Reference

License

Released under the MIT License

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.