Git Product home page Git Product logo

envoy-microservices-patterns's Introduction

Microservices Patterns with Envoy Proxy

... from this blog: http://blog.christianposta.com

The intention of these demos is to help a reader understand how the Envoy Proxy can be used to implement resilient microservices patterns. Each demo focuses on different Envoy Proxy configurations that can be used to implement the desired behavior.

Overview

To run the examples, make sure you have access to a docker daemon. If you type:

docker ps

You should see a response without errors.

Running the demos

To start a demo, run the script (or do it manually) and pass in the parameters for the demo you want to run. Each demo configures the Envoy Proxy differently and may experience different behaviors.

The format for bootstrapping a demo is:

./docker-run.sh -d <demo_name>

For example, to run the circuit-breaker demo:

./docker-run.sh -d circuit-breaker

You can stop the http-client's respective demos with:

./docker-stop.sh

The other various scripts allow us to run the http client (which will be proxied by Envoy):

  • run-http-client.sh - runs the Java http client using environment variables specified for each demo (in each dir's http-client.env file
  • curl.sh - executes a single curl command inside the http-client+envoy container; useful for tests that just need a single (or couple) http calls
  • get-envoy-stats.sh - queries the Envoy Proxy's admin site for statistics that we can use to interrogate the behavior of the demo and verify it
  • reset-envoy-stat.sh - useful for resetting the Envoy Proxy's statistics to re-run some demos/test cases
  • port-forward-minikube.sh useful if using minikube to expose ports locally on your host

Lastly, each demo contains a http-client.env file that controls the settings of the http-client we use. Example:

NUM_THREADS=1
DELAY_BETWEEN_CALLS=0
NUM_CALLS_PER_CLIENT=5
URL_UNDER_TEST=http://localhost:15001/get
MIX_RESPONSE_TIMES=false

We can control the concurrency with NUM_THREADS and the duration with NUM_CALLS_PER_CLIENT. For example, in the above configuration, we'll use a single HTTP connection to make five successive calls with no delays between calls (note that DELAY_BETWEEN_CALLS is 0). We can adjust these settings for each of the demos.

envoy-microservices-patterns's People

Contributors

cch0 avatar christian-posta avatar wliu-zuora avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

envoy-microservices-patterns's Issues

Circuit Breaker Demo Doesn't Work

I ran the circuit breaker demo from the blog post and I didn't get the expected otuput:

./docker-run.sh -d circuit-breaker                                         

circuit-breaker
63b4b5c03715d64ee6bc8a8ca4b4fc4c8795dd21aa42034421d39a0c66ffedd1
docker exec -it client bash -c 'java -jar http-client.jar'                   

using num threads: 1
Starting pool-1-thread-1 with numCalls=5 parallelSends=false delayBetweenCalls=0 url=http://localhost:15001/get mixedRespTimes=false
pool-1-thread-1: successes=[0], failures=[5], duration=[15418ms]

I'm running this on MacOS 10.15.2.

Unable to read file : /etc/envoy/envoy.json

Hi,

I am trying to run the demo by following command

./docker-run.sh -d circuit-breaker

The container exits and upon looking into the logs it says : Unable to read file : /etc/envoy/envoy.json

Kindly please help to resolve this.

I am running Docker on Windows.

Prometheus metrics?

On the blog articles that correspond to this repository the table of contents indicates that Prometheus metrics exposition was intended as the fourth (next) article in the series.

I'm very interested in Prometheus exposition from Envoy, and I'm wondering if you could give me a hint about how you were planning to go about it. I have a couple of thoughts so far. First, I see that Envoy's native /stats endpoint on the admin port is a bit like statsd output.

  1. I was thinking a bit about using the Prometheus statsd-exporter in order to provide a sink for Envoy to flush to, but I'm not yet familiar enough with the Envoy stats format to have a sense of how many rules would be called for to extract the varying portions of the stat names.
  2. Envoy itself could be extended to natively provide metrics in Prometheus's exposition format. I'm not yet familiar enough with the codebase to have a sense of how much effort would be called for to take this approach, though the docs signal that it shouldn't be too hard.

What do you think? Were you imagining going for one of the above approaches, or do you have something else in mind? I'm interested to implement this (depending on effort required), so if you have a thought of a good route, I may come back shortly with a pull request.

circuit_breakers configuration has moved to envoy.yaml

The master release is no more inline with the circuit breaking demo and the docker image ceposta/http-envoy-client because the envoy.json does not contain the circuit_breakers configuration anymore:
https://blog.christianposta.com/microservices/01-microservices-patterns-with-envoy-proxy-part-i-circuit-breaking/
the consequence is sending the traffic directly to Envoy Proxy using (docker exec -it client bash -c 'java -jar http-client.jar') fails.

To succeed with the circuit breaking demo, the commit from 2 years ago has to be used:
https://github.com/christian-posta/envoy-microservices-patterns/tree/fb80cfb2b11b80f68c7acb561caf77c874d5d687

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.