Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This spec only points out federation strategy for Mbeans. The Mbean modeling and details about the Mbeans are mentioned in related document section.

Related Document

  1. https://wikicwiki.gemstoneapache.comorg/confluence/display/ToolingGEODE/Proposed+GemFire+MBeans
  2. https://wikicwiki.gemstoneapache.comorg/confluence/display/ToolingGEODE/MBeanServer+Federation+Strategy
  3. https://wiki.gemstone.com/download/attachments/33456981/JMXFederation-POC.pdf

...

GemFire Services For Management & Monitoring

GemFire will provide following services for Management and Monitoring.

  1. Single Agent View of Distributed System MBeans
  2. Management Resources : Connectors and predefined MBeans.
  3. Inbuilt Federation Mechanism
Single-Agent View

With a single-agent view, the application or manager interacts with one MBeanServer. Application and manager development is much easier because they don't have to find the right MBeanServer to make a request on an MBean. That MBeanServer is responsible for aggregating all of the MBeans in the MBeanServers with which it is federated. This is very convenient because the application or manager can interact with a local MBeanServer that has services and adapters to interact with other local or remote MBeanServers. The location of the federated MBeanServers does not change how the application or manager is programmed to interact with its MBeanServer. For the sake of this discussion, we will refer to the single-agent MBeanServer as Managing Node. The MBeanServers that the master interacts with (and the application does not) will be referred to as Managed Node.

GemFire achieves Single-Agent View by creating MBean proxies at Managing Node side and keeping their state in sync with their Managed node counterpart.

Management Resources
  • Managed Node

    Any manageable node which is not managing other members is managed node. 

    Managed node has following resources allocated so that it can answer jmx queries both locally and remotely.

  1. An RMI Connector which will allow JMX Client to connect directly to the node to and get access to all local MBeans.
  2. Local MBeans : representing the local monitored components on this node.
    1. MemberMBean
    2. RegionMBean
    3. ClientServiceMBean
    4. LockServiceMBean
    5. DiskStoreMBean
    6. GatewaySenderMBean
    7. GatewayReceiverMBean
    8. LocatorMBean
    9. Management MBean with Scope=LOCAL
  3. Built in platform MBeans
  4. Custom MBeans
  • Managing Node

    Managing node has following extra resources allocated so that it can answer jmx queries

  1. An RMI Connector which will allow JMX Client to connect to and get access to all MBeans of the distributed system
  2. Local MBeans : representing the local monitored components on this node. Same as any other managed node
  3. Aggregate MBeans :
    1. DistributedSystemMBean
    2. DistributedRegionMBean
    3. MemberGroupMBean
    4. DistributedLockServiceMBean
  4. Management MBean with Scope=ALL which allows various DS-wide operations.
  5. Proxy to MBeans on managed nodes
  6. Built in platform MBeans
  7. Custom MBeans
Inbuilt Federation Mechanism

GemFire federation mechanism is the process by virtue of which we can achieve single agent view.The protocol used is internal to GemFire and does not interfere with any application and manager implementation.

GemFire federation takes care of the following functionality

  1. MBean proxy creation
  2. MBean state propagation
  3. notifications propagation
  4. operation invocation.
    GemFire federation is not limited to predefined MBeans only. In fact users can write their own MBeans and GemFire will provide a federated view of their MBean.
  • MBean/Proxy Naming Convention

    Each GemFire MBean will follow a particular naming convention for easier grouping 

    e.g. GemFire:type=Member,service=LockService,name=<dlsName>,memberName=<memberName> 

    At the managing node this MBean will be registered with GemFire/<memberId> as domain 
    e.g. GemFire:type=Member,service=LockService,name=<dlsName>,memberName=<memberName>

Application Program Interfaces

GemFire Management API represent the Gemfire System view to a JMX user. However it does not intend to provide functionality which is otherwise present in JMX. It only provides a gateway into various services exclusively offered by GemFire Management.

The entry point to GemFire Management is through interface ManagementService
ManagementService service = ManagementService.getManagementService(cache);

The implementation of getManagementService is a singleton for now but it allows us to eventually support multiple cache instances (probably multiple client caches and on peer cache). The resulting ManagementService instance will be specific to the provided cache and its distributed system. Also the instance will behave differently when the cache is a client cache vs a peer cache. When its a client cache then execution of a command string should be forwarded to the cache server instead of processed in the local JVM. More detailing needs to be done for client cache.

  • APIs useful at Managed Node

     

    Code Block
    languagejava
    public class ManagementService {
    
      
    /**
    
       * It will a singleton instance across a Cache. This instance will
    
       * act as th einterface between user and GemFire Management.
    
       * @param Cache
    
       * @return ManagementService
       
    */
    
      public static ManagementService getManagementService(Cache cache){}
    
      
      
    /**
    
       * This will register the MBean in default GemFire domain.
    
       * Any MBean which wishes to register itself in Gemfire
       * domain should use 
    * domain should use this
    this method.
       
    * Note: The ObjectName will be modified here. Hence returning the 
    
       
    * modified ObjectName.
    
       
    */
    
      public ObjectName registerMBean(Object object, ObjectName objectName)
    {}
    
      
       
    
      
    /**
    
       * For consistency and clean up of GemFire resources 
       
    * use this method to unregister the MBean from GemFire Domain
    
       
    */
    
      
    public void unregisterMBean(ObjectName objectName){}
    
        
    
      /**
    
       * This method is used to mark an MBean for federation.
    
       * 
    
       * Users may want to only register their MBean in GemFire domain. In that
       
    * case they don't have to call federate();
       * 
       
    * 
    *
    @param <T>
    
       * @param name MBean name 
    
       * @param interfaceClass MBean interface class
    
       * @param notificationEmitter is the MBean a notification emitter
    
       * @return
    
       */
    
      public <T> boolean federate(ObjectName name, Class<T> interfaceClass,
    boolean notificationEmitter) {}
     boolean notificationEmitter) {}
      /**
    
       * This method is used to process a command 
    
       * This takes an String is a parameter.
    
       * @param commandString
    
       * @return
    
       */
    
      public Object processComand(String commandString){} 
    
      
    
    
      
    /**
       
    * Interfaces to get all GemFire specific MBeans
    
       
    *
    
       
    */
    
      
    public RegionMXBean getLocalRegionMXBean(Region region)  {}
    
      public LockServiceMXBean getLocalLockServiceMXBean(String name){}
    
    
      
    ....
    
      
    ....
    
    }
  • APIs useful for MBean Federation

    Usage : 

    MyCustomMXBean myMbean = new MyCustomMBean();
    ManagementService service = ManagementService.getManagementService(cache); 
    
    //To register in Gemfire domain
    // GemFire will modify the given ObjectName to append memberName
    ObjectName newObjectName service.register(myMbean, name);
    
    
    /**To allow MyCustomMBean to be federated 
    *
    */
    service.federate(newObjectName, MyCustomMXBean.class, false);
    
    

     

  • APIs useful at Managing Node

     

    public class ManagementService {
    
    
             /**
               * This method will be invoked whenever a member wants to be a managing node. The
               * exception Management exception has to be handled by the caller.
              */
              public void startManager() {}
    
              /**
               * This method will be invoked whenever a member stops being a managing node.
               * The exception Management exception has to be handled by the caller.
               * This will stop all the activities and clean up resources pertaining to
               * Managing Node
               * 
               */
               public void stopManager() {}
    
              ....
              ....
             /**
    	 * This will return a set of MBean proxy names for a given member name
    	 * @param memberName
    	 * @return
    	 */
    	public Set<ObjectName> queryProxyMBeans(DistributedMember memberName) {}
    
     
            /**
    	 * The method will return the proxy instance represented by the ObjectName.
    	 * 
    	 * It will be an actual reference to the proxy instance rather than an
    	 * ObjectInstance.
    	 * 
    	 * @param <T>
    	 * @param objectName
    	 * @return
    	 * @throws ManagementException
    	 * @throws InstanceNotFoundException
    	 */
    	public <T> T getMBeanProxy(DistributedMember memberName,
    			ObjectName objectName, Class<T> interfaceClass){}
         
            /**
    	 * This will return the last updated time of the proxyMBean
    	 * 
    	 * @param memberName
    	 * @return
    	 */
    	public long getLastUpdateTime(ObjectName objectName) {}
    
    	public Object processComand(String commandString) {}
    	
    
    
          /**
           * Methods to get remote MBean proxy reference
           */
    
            public RegionMXBean getRemoteRegionMXBean(DistributedMember memberName ,Region region) {}
    		
    
    	public LockServiceMXBean getRemoteLockServiceMXBean(DistributedMember memberName, String name) {}
            
            ..........
            .............
    
    
    }
    

...