Giter Site home page Giter Site logo

nrpc's Introduction

This is a protobuf-rpc implement base on nginx.
Using nginx core/event modules as network framework, and provides simple programming interfaces.

Why Nginx:
Nginx implements a set of excellent event and network interface. RPC framework written with these interface can be used well in the Internet environment, for example, it can be used as the network layer of mobile app

How to use Nginx:
In order to guarantee minimum changes to the nginx, the RPC framework acts as a nginx module which will be dynamically added into the nginx module list at initialization time.
The listen port, protobuf service information which users fill through the programming interface are just the same as configuration parameters of this nginx module. Finally call the main function of nginx(renamed as ngx_start) to start the service.
And also users can configure the nginx core/event modules with conf/nginx.conf, just the same as Nginx itself.

Features:
basic RPC functions, such as:
	1. port configuration
	2. service add/del
	3. timeout configuration
	4. local_session_context, etc.
some additional features.
In server side:
	1. inherited all attributes of nginx core/event module;
	2. connection keepalive and reuse
	3. QPS current limit
In client side: (implement based on pthread)
	1. provide sync/async mode
	2. automatic retry mechanism
	3. connection pool and reuse

How to start:
first of all, build the libngx.a with follow command. And before that, please read nginx/README
	cd nginx && ./ngxlib_install.sh your/path/of/nginx && cd ..
then build the libngxplus.a and libnrpc.a
	cd ngxplus && make && cd ..
	cd src && make && cd ..
now we can programme our app, build with "-lngx -lngxplus -lnrpc", refer to sample/

Additional, some string,network,pthread util function are used, my code tree as follow:
code-manager:
	|-common
	|	|-*.cpp
	|	`-test
	|-nrpc
	|	|-nginx
	|	|-ngxplus
	|	|-src
	|	|-test
	|	`-sample
	|-thirdsrc
		|-gflag
		`-gtest
the common module, you can implement youself, or refer to https://github.com/zmkeil/common.git

An associated implement of JAVA client, refer to https://github.com/zmkeil/jrpc-client

For details, refer to blog http://www.cnblogs.com/zmkeil/p/5176758.html

nrpc's People

Contributors

zmkeil avatar

Stargazers

zhaoyao avatar

Watchers

James Cloos avatar

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.