Git Product home page Git Product logo

foo-proxy's Introduction

foo-proxy

A proxy for a simple TCP protocol that records certain message-level metrics. Uses Java's non-blocking I/O building blocks in the java.nio package.

Usage

Prerequisites: the Leiningen build tool, and Java >= 7.

$> lein uberjar
$> java -Dlisten=8002 -Dforward=localhost:8001 -jar target/foo-proxy-0.1.0-SNAPSHOT-standalone.jar

Metrics can be requested by sending SIGUSR2 to the JVM process:

$> kill -s USR2 $(jps | grep foo-proxy | awk '{ print $1 }')

The JVM process will dump metrics to stdout.

SIGUSR1 was not used because it is reserved by the JVM and cannot be used in applications.

Todo

There is one flaw in the metrics processing: for sliding window metrics, requests are kept in a deque, which is never cleaned up. This will sooner or later lead to out-of-memory errors.

The deque should be cleaned up periodically, deleting events that are no longer needed.

As a stop-gap measure for testing over a longer period of time, the heap size can simply be increased:

java -Xmx=1024m ... 

License

Copyright © 2016 Johannes Staffans

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

foo-proxy's People

Contributors

jstaffans avatar

Watchers

 avatar

Forkers

jartysiewicz

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.