layout | title | categories | parent | weight |
---|---|---|---|---|
post |
Mirror Monitor |
SBP |
production.html |
700 |
{% tip %}
Summary: Mirror Service Monitoring Utility
Author: Shay Hassidim, Deputy CTO, GigaSpaces
Recently tested with GigaSpaces version: XAP 7.1
Last Update: April 2010
Contents:
{% toc minLevel=1|maxLevel=1|type=flat|separator=pipe %}
{% endtip %}
The Mirror Service is an essential component when persisting your data into the enterprise database. The Mirror Service delegates the IMDG activities into the database in a reliable asynchronous manner, allowing the application to access the data stored in-memory without having the database as part of the critical path of the transaction. When using the Mirror Service, the database performance and availability would not impact the application response time.
The Mirror Service behavior is important for the stability of the application and the consistency of the data within the Database. With large scale application, you might want to monitor the Mirror Service behavior in real time. This means reacting in a timely fashion in case there is a need to intervene with its activity or related components that interacts with the Mirror Service (IMDG, Database).
The Mirror Monitor utility gathers statistics about the Mirror Service behavior and exposes these via standard JMX Mbean. You may access this collected data using standard JMX viewers such as the JConsole utility comes with the JVM.
The Mirror Monitor extends the built-in openspaces DefaultHibernateExternalDataSource
, and collects statistics about the activities the mirror performs. You may log these statistics into a log file or/and access these by using the JMX API.
The Mirror Monitor using the GigaSpaces Administration and Monitoring API to receive information about the current status of the replication redo log size of all the IMDG primary instances. When having multiple partitions for the IMDG, the redo log value exposed is a sum of all the IMDG primary instances current replication redo log size.
This utility collecting stats about:
- Write, Update, Take operations count executed by the Mirror.
- Write, Update, Take operations current throughput executed by the Mirror.
- Redo log size accumulated at the primary spaces.
The Mirror Monitor includes the following:
IMirrorStats
Interface - required for the JMX MBean.MirrorStats
- JMX MBean exposing the statistics collected.Mirror
- extends theDefaultHibernateExternalDataSource
, and calculates the current Mirror Write/Update/Remove speed.SpaceModeListener
- Identify a failure of the primary space and switch monitoring the new primary.
In order to use the Mirror Monitor with your application you should:
- Download the Mirror Monitor project.
- Add the Mirror Monitor classes into your Mirror PU.
- Change the Mirror pu.xml configuration to have this:
{% highlight java %}
<os-core:space id="mirror" url="/./mirror-service" schema="mirror" external-data-source="hibernateDataSource" /> {% endhighlight %}
Properties List:
{: .table .table-bordered} |Property|Description|Default Value| |spaceName|Space Name to monitor|mySpace| |sessionFactory|Hibernate Session|sessionFactory| |ide|Should be true of Mirror running within the IDE. Should be used in Development mode.|false| |debug|Will bypass the Database calls. Should be true only when debugging. |false| |displayStats|When true will display the Mirror stats to output. Should be used in Development mode.|false|
{% info %} The example assumes that space is deployed before the mirror,if you require otherwise,then you should move the code from Mirror.init method to first call of collectStats() (when space is available.) {% endinfo %}
To view the Statistics gathered by the Mirror monitor:
-
Start the JConsole via the Gigaspaces Mangament Console for the Mirror Service:
-
Move into the MBeans Tab and select the com.gigaspaces.util.mirror.monitor:
Double clicking any of the values, will display a graph that will be refreshed automatically. Without having the graph displayed, you will have to click the Refresh button manually to see the most updated values for each statistic.