Skip to main content

Using Diffy Docker image

Pre-requisite installation

  1. Docker

Pulling the Diffy image

Let's start by pulling the latest Diffy docker image from DockerHub using the following command:

docker pull diffy/diffy

Verify primary, secondary, and candidate service instances

Please verify that all three instances of the service that needs to be tested are deployed.

Launch Diffy

Diffy needs 2 ports one to serve the UI and another to receive sample traffic that will be multicast to primary, secondary and candidate. Please make sure the default values of these ports are 8888 and 8880 and you can override these defaults with your choice of ports in the launch command. Regardless, of what ports you launch Diffy with, please make sure the ports are free to be allocated to Diffy.

Let's launch Diffy with the following command:

docker run --env OTEL_JAVAAGENT_ENABLED=false -d --name diffy-01 \
-p 8880:8880 -p 8888:8888 \
diffy/diffy env \
--candidate=<candidate> \
--master.primary=<primary> \
--master.secondary=<secondary> \
--responseMode=primary \
--service.protocol=http \
--serviceName="Example Service" \
--proxy.port=8880 \
--http.port=8888 \
--rootUrl=localhost:8888

Note: For a detailed definition of all Diffy settings, please refer to the Settings section.

Send sample traffic

Our Diffy topology is now ready to receive traffic on proxy.port i.e. http://localhost:8880.

If you are using the example service instances using ./example/downstream.sh from our github repository, then you can use the following curl commands to send some traffic to your Diffy instance:

curl -s -i -X POST -d '{"name":"Microsoft"}' -H "Canonical-Resource:json" http://localhost:8880/json
curl -s -i -X POST -d '{"name":"Twitter"}' -H "Canonical-Resource:json" http://localhost:8880/json
curl -s -i -X POST -d '{"name":"Airbnb"}' -H "Canonical-Resource:json" http://localhost:8880/json
curl -s -i -X POST -d '{"name":"Mixpanel"}' -H "Canonical-Resource:json" http://localhost:8880/json
curl -s -i -X POST -d '{"name":"Cigna"}' -H "Canonical-Resource:json" http://localhost:8880/json

We have now successfully sent multiple requests to Diffy on its proxy port which have been multicast to primary, secondary, and candidate. The resulting response triplets have been compared by Diffy and aggregated into a view that we can now see in the UI.

View the results

The Diffy UI hosted at http://localhost:8888 should look something like this: Diffy