allegro/allegro-tech-labs-microservices

Name: allegro-tech-labs-microservices

Owner: Allegro Tech

Description: Allegro Tech Labs Microservices workshop materials

Created: 2018-04-13 10:57:37.0

Updated: 2018-04-27 10:28:38.0

Pushed: 2018-04-27 10:31:56.0

Homepage: null

Size: 3745

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Allegro Tech Labs - Microservices a'la allegro

Requirements

Environment

Everything is run in Ubuntu 16 box on Vagrant. Box contains:

Setup

Start Vagrant box by running the following command in project root directory:

ant up

Directory in which Vagrantfile is present will be mounted on virtual machine as /vagrant. Any changes done on host system (editing files etc) are immediately visible to virtual machine and vice versa.

Check the setup

After starting Vagrant box you should be able to see Grafana login window at 10.10.10.10:3000. Credentials are admin/admin.

Applications

Upon start no applications are running. Apps are controlled using supervisord.

To start applications use supervisorctl:

 supervisorctl
t data-server
t main-service

To restart running application:

 supervisorctl
art main-service

They are started using simple ./gradlew bootRun in /vagrant/<app> directory. This means that you can edit source files in IDE on host system and restart application in virtual machine for changes to take effect.

Database

Data is located in allegro_tech_labs database, offers collection. There should be 100 000 entries.

o
e allegro_tech_labs;
.offers.size();
00
Toxic proxies

After startup, there should be 3 proxies present and used by main-service. To find out just type:

proxy-cli list

and you should see a similar list:

            Listen      Upstream        Enabled     Toxics
==================================================================================
ription_service 127.0.0.1:9998  localhost:8888      enabled     None
ery_service     127.0.0.1:9999  localhost:8888      enabled     None
o           127.0.0.1:27117 localhost:27017     enabled     None

: inspect toxics with `toxiproxy-cli inspect <proxyName>`
Few examples:
proxy-cli toxic add mongo -n mongo_latency -t latency --tox 0.05 -a latency=10

now calling toxiproxy-cli list should print following results:

            Listen      Upstream        Enabled     Toxics
==================================================================================
ription_service 127.0.0.1:9998  localhost:8888      enabled     None
ery_service     127.0.0.1:9999  localhost:8888      enabled     None
o           127.0.0.1:27117 localhost:27017     enabled     1

: inspect toxics with `toxiproxy-cli inspect <proxyName>`
proxy-cli toxic update -n mongo_latency --tox 0.1 -a jitter=50 mongo

now calling toxiproxy-cli inspect mongo should print following results:

: mongo Listen: 127.0.0.1:27117 Upstream: localhost:27017
==================================================================
ream toxics:
y has no Upstream toxics enabled.

stream toxics:
o_latency:  type=latency    stream=downstream   toxicity=0.10   attributes=[    jitter=50   latency=10  ]

: add a toxic with `toxiproxy-cli toxic add`
proxy-cli toxic remove -n mongo_latency mongo
Wrk2

“wrk2 (as is wrk) is a modern HTTP benchmarking tool capable of generating significant load when run on a single multi-core CPU. It combines a multithreaded design with scalable event notification systems such as epoll and kqueue.”

Few examples

Call wrk, pass extra -s random_offers.lua argument and modify HTTP address to server root:

 -t2 -c20 -d60s -R100 --latency -s random_offers.lua http://127.0.0.1:8080

This will cause Wrk2 to randomly query for different offers (uniformly distributed).


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.