Code Monkey home page Code Monkey logo

monitoring-akka-prometheus-kamon's Introduction

Monitoring Akka Applications with Kamon

This project serves as a playground for trying out monitoring options for both single noded and clustered (sharded) Akka applications.

The application itself is a simulation of Conveyor Sorting Subsystem and its original code (without monitoring and using older Akka version) can be found in akka-sharding-example repository.

Building the application

To build the application, use build_docker.sh script, which uses sbt to build the fat jar and docker-compose to build the image.

Running the application

This project uses Prometheus as monitoring solution. You can run both the application (single noded) and Prometheus using Docker Compose that is included in the project. Execute docker-compose up and go to localhost:9090 to see Prometheus GUI.

Generating traffic

We can generate lots of HTTP requests using these tools:

  • ab - Apache HTTP server benchmarking tool,
  • parallel - GNU Parallel - The Command-Line Power Tool,
  • haproxy - fast and reliable http reverse proxy and load balancer,
  • provided URLs.txt for single-noded app,
  • provided shardedURLs.txt and haproxy.conf.

You can install these tools manually or using install_load_test_tools.sh script.

SingleNodedApp

Just run SingleNodedApp from your IDE or sbt runSingle and then:

cat src/main/resources/URLs.txt | parallel -j 5 'ab -ql -n 2000 -c 1 -k {}' | grep 'Requests per second'

ShardedApp (2 nodes)

You can run two nodes by executing:

  • first node: sbt runSharded
  • second node: sbt '; set javaOptions += "-Dclustering.port=2552" ; set javaOptions += "-Dapplication.exposed-port=8081" ; set javaOptions += "-Dmetrics.enabled=false" ; runSharded'

We want to balance the traffic between the two nodes. Simple configuration for haproxy daemon can be found in resources dir. Run it with: haproxy -f src/main/resources/haproxy.conf

This will set up a round-robing load balancer with frontend on port 8000 and backends on 8080 and 8081. You can then use different shardedURLs.txt file:

cat src/main/resources/shardedURLs.txt | parallel -j 5 'ab -ql -n 2000 -c 1 -k {}' | grep 'Requests per second'

Generating Flame Graphs

You can generate Flame Graphs for specified Java PIDs (use jps to find out the PID) by executing generate_flamegraph.sh script.

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.