Git Product home page Git Product logo

grpc-gevent's Introduction

Description

This is an example repository showing what happens if you use gevent with grpc, and demonstrating that running grpc calls in a gevent.threadpool allows gevent to run normally.

Setup

You can run make setup, or read the Makefile and copy the directions there as you see fit.

Running

In one terminal:

$ go run server.go

In another terminal:

$ python client.py
2018-01-05 16:53:24.637027 [ 1] Started
2018-01-05 16:53:24.637386 [ 1] Spawned
2018-01-05 16:53:24.637804 [ 2] Started
2018-01-05 16:53:24.638113 [ 2] Spawned
2018-01-05 16:53:24.638290 [ 3] Started
2018-01-05 16:53:24.638590 [ 3] Spawned
...
2018-01-05 16:53:25.645519 [ 1] Received
2018-01-05 16:53:25.645593 [ 2] Received
2018-01-05 16:53:25.645652 [11] Received
2018-01-05 16:53:26.642848 [ 4] Received
...
Finished in 0:00:10.016921

Note that python client.py plain will attempt to use gevent with grpc and just be synchronous (taking >50 s), whereas the default python client.py uses the gevent threadpool to actually do concurrent grpc requests and finishes in ~10 seconds.

grpc-gevent's People

Contributors

wackywendell avatar

Watchers

 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.