MoSKito is a performance oriented product from company called Anotheria located in Germany and Ukraine. In contrast to many other products MoSKito has great documentation that exposes nearly all possible aspects of its integration and usage. MoSKito is open sourced and available on nexus and github. If you use maven in your projects then integrating MoSKito is very easy.

MoSKito actually consists of 3 components:
  1. MoSKito Essentials
  2. MoSKito Control
  3. MoSKito Central
MoSKito Essentials is the only mandatory component that you need to enable monitoring for single application. After adding a couple of maven plugins and dependencies to your project you are getting out-of-the-box monitoring information about threads, memory, runtime, OS and MBeans by following the link http://your_host:your_port/your_app_context/mui/:
Screen Shot 2013-07-10 at 5.31.09 PM.png
Of course this nice MoSKito WebUI interface is only shown if your app is running on a servlet container with Servlet 3 support. If you have an older container you can still manage well by modifying your web.xml a bit. Additionally you can configure MoSKito to log monitoring information into the files that could be later scanned or analysed.

There are several ways to enable custom monitoring for your application with MoSKito Essentials so your application specific statistics will appear along with built-in statistics. The simplest way is to annotate your classes or methods with @Monitor or @Count annotations and let compile time weaver do all the rest:

@Monitor
public class YourClass {…}

@Count
public class PaymentCounter {…}

@Monitor(producerId="MyProducer", subsystem="mySub", category="myCategory")
public class YourAnotherClass {…}

For CDI integration you should add MoSKito interceptors to beans.xml. For web applications you can add MoSKito filters or listeners to web.xml or implement MoskitoHttpServlet to monitor requests.

The other way to add monitoring is to utilise MoSKito ProxyUtils class to create proxies for any object like this:

SimpleService service = ProxyUtils.createServiceInstance(new SimpleServiceImpl(), “default", SimpleService.class);

If you want to monitor just a part of the method you can use CallExecution object to define monitored section like this:

CallExecution execution = producer.getStats(“phase1").createCallExecution();
execution.startExecution();
//now we are doing something extremely important…
execution.finishExecution();

MoSKito Control is a component for monitoring performance of multiprocess applications meaning the applications that consists of several JVMs or in terms of MoSKito “nodes". After you add MoSKito Essentials to each node you must also add another component to each node called Agent. Again adding an agent is as easy as adding single dependency to your pom.xml if you have Servlet 3 compliant container. The agent is exposing monitoring information of your app on demand by http request to url http://your_host:your_port/your_app_context/moskito-control-agent/status.

You must setup an additional web application called MoSKito-Control server which essentially gathers statuses from all nodes and present all of them on a single screen. The idea of MoSKito Control is illustrated below:
moskito-control_overview.png
The last but not least component is MoSKito Central. This component is used to store all monitoring statistics in files, database or in memory. In order to store statistics you must add another dependency to maven that adds to your application a connector that is communicating with MoSKito Central via http or RMI. Again you need MoSKito Central to be installed as a separate storage component or to run it with in-process mode. The main idea of using MoSKito Central is shown below:
moskito-central_connectors.png
MoSKito provides many other useful features like setting thresholds to statistics and alerting about problems via log, system output or email. There is even an iOS app for MoSKito Control.

In general MoSKito looks like very promising product. MoSKito is definitely a java developer oriented tool that could be easily integrated into any java application. MoSKito is free and open-sourced. Also it has built-in integrations with most popular frameworks and it’s fully “mavenized". Be aware that although MoSKito Essentials component is stable and production ready however MoSKito Control and MoSKito Central are partially in beta. Anyway MoSKito support is available for everyone as well as premium assistance for deep integration and long-term cooperation.

I wish guys from Anotheria all the best: I’ve really enjoyed exploring and piloting their technology.

Recommended by Vladimir Krasilschik @ Kupchino Labs,
Saint-Petersburg, Russia

Links: