[ 
https://issues.apache.org/jira/browse/MARMOTTA-408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13909710#comment-13909710
 ] 

Rajika Kumarasiri commented on MARMOTTA-408:
--------------------------------------------

hello, 

I think we need to implement the following two things in order to implement 
this functionality. 
1. Implement the new statistics collecting infrastructure using JMX+MBeans. 
2. Re factor the current source code base to depend on that new statistics 
infrastructure. 

And here how to do it. 

#1. 
First we need a JMX server connector started at the Marmotta server start up 
time which will expose all the registered MBeans. In order to do this we need 
to have a local RMI registry(JNDI) port. If the JMX server connector shall be 
used in a firewalled environment, additionally a fixed RMI port should be 
provided and both ports should be opened in the firewall. We should provide 
configurations to users so that they can configure(assume default ports in case 
of missing configurations) and the JMX  server connector url at Marmotta server 
start up will look like below. 

service:jmx:rmi:///jndi/rmi://<hostname>:<jndiPort> - JMX URL used if only JNDI 
port is provided.

service:jmx:rmi://<hostname>:<rmiPort>/jndi/rmi://<hostname>:<jndiPort> - JMX 
URL used if JNDI port and RMI port are provided. 

We need to have a 'MBeanRegister' API which will actually register various 
MBean at various locations in Marmotta into the above JMX server connector. 
It's API will look like below. 

MBeanRegistrar#registerMBean(Object mBeanInstance, String id)
MBeanRegistrar#unRegisterMBean(String id)

Using this 'MBeanRegistrar' API, other components will be able to register 
their MBeans into the MBean server. They have to create the MBean instance with 
what ever data/stats and pass it as the 'mBeanInstance'. So it will be 
registered in the MBean server. This MBean server will be the single location 
which will persist all statistics data. Of course this MBean server(JMX server 
connector) can be accessed by any JMX client such as JConsole. There will be 
single instance of 'MBeanRegister' (singleton pattern) in the running Java 
process so that any body can access it in order to persist their MBeans into 
the server.  

#2. 
Now in order to use the above stats collecting infrastructure, various 
components in Marmotta should define their MBean with the data/stats that they 
want to pump and use the API call MBeanRegistrar#registerMBean(Object 
mBeanInstance, String id) in the MBeanRegister instance(singleton). By 
implementing this way we can extend the JMX functionality in future without 
affecting the other components and we can re-factor the current statistics 
collecting logic to use JMX based infrastructure with minimal code changes to 
the current source code. 

It seems following components/modules has to be replaced from the above 
infrastructure in #1 and provide JMX MBeans to the components which depend on 
the below components/modules to expose their stats using the new JMX based 
infrastructure. 
a) org.apache.marmotta.platform.core.api.statistics
b) org.apache.marmotta.platform.core.services.statistics
c). org.apache.marmotta.platform.core.services.statistics.ehcache

What would be the other places that gather stats? What would be the 
components/modules that expose stats currently?  

I think we can have a separate package inside 
org.apache.marmotta.platform.core.jmx to develop the above infrastructure and 
it's utilities.  

If you would like to see a POC I can work on a possible patch for above. If 
Apache get accepted to participate in gsoc 2014, I would like to submit a 
proposal for this. 

I appreciate your comments and feedback.   

 

> Use MBeans / JMX for monitoring  and statistics
> -----------------------------------------------
>
>                 Key: MARMOTTA-408
>                 URL: https://issues.apache.org/jira/browse/MARMOTTA-408
>             Project: Marmotta
>          Issue Type: Improvement
>          Components: Platform
>            Reporter: Sebastian Schaffert
>            Assignee: Sebastian Schaffert
>              Labels: gsoc2014, java, jmx
>
> We should use JMX for monitoring different aspects of the Marmotta system, 
> e.g. the caching statistics. This should replace the existing 
> StatisticsService, providing a new infrastructure to store and push via JMX 
> different parameters, allowing to monitor Marmotta from any of the available 
> JMX tools.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to