Coder Social home page Coder Social logo

managed-utils's Introduction

Managed utilities Build Status Maven Central codecov.io

This project holds some utility classes that expose bean properties as JMX attributes. First and foremost, it holds classes that expose the queue sizes of some common thread pool implementations, since I was unable to find this done anywhere else.

Install

Import the dependency into your project.

On maven, use:

<dependency>
  <groupId>com.pcarneiro.utilities</groupId>
  <artifactId>managed-utils</artifactId>
  <version>${managed-utils.version}</version>
</dependency>

Several other dependency managers are supported. Please check the Maven Central repository page for further details.

Usage

Wrap your thread pool implementation with one of the provided classes.

Example (for Spring based XML configuration):

<bean id="my.managed.executor" class="com.pcarneiro.utilities.managed.ManagedThreadPoolExecutor"
      c:executor-ref="my.executor"/>

Similarly, you can also wrap your Guava Cache to expose statistics:

<bean id="my.managed.cache" class="com.pcarneiro.utilities.managed.ManagedCache"
      c:cache-ref="my.cache"/>

Then, expose the bean through JMX:

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
  <property name="beans">
    <map>
      <entry key="bean:name=myManagedExecutor" value-ref="my.managed.executor"/>
      <entry key="bean:name=myManagedCache" value-ref="my.managed.cache"/>
    </map>
  </property>
</bean>

Motivation

Thread pools are a relevant tool, when it comes to unleashing the potential of the JVM concurrency capabilities. When used along with a task queue, they can even be effectively used as rate limiters.

As such, it's important to monitor these queues, to evaluate how to dimension your thread pool, and to better understand how it behaves under load.

Should you collect your metrics from managed beans, then this project may be useful to you.

managed-utils's People

Contributors

pedro-carneiro avatar

Stargazers

 avatar

Watchers

 avatar  avatar

managed-utils's Issues

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.