1 2 3 Previous Next 33 Replies Latest reply on Dec 28, 2005 10:00 PM by ben.wang Go to original post
      • 15. Re: Exposing JBossCache Management Attributes
        belaban

        I'm referring to JmxConfigurator.registerChannel()

        • 16. Re: Exposing JBossCache Management Attributes

          Very nice dynamic registration of the jgroups protocol mbeans. As suggested, we could do something similar for cache interceptors. Each interceptor would be configured with a corresponding mbean (possibly directly, possibly using the delegation approach used with the protocols). In any case, the user wouldn't have to incorporate the interceptor mbeans into the cache's service.xml configuration file.

          At first thought, it seems like the user would only need to incorporate a single cache management mbean (the new one previously discussed). Initiation of this mbean would then trigger registration of the various interceptor mbeans. We might also consider allowing for enabling/disabling individual cache interceptor mbeans (e.g., stats=false) although the cache interceptors aren't exposed in the same manner as jgroups protocols so this may not be applicable.



          • 17. Re: Exposing JBossCache Management Attributes

            JBCACHE-154 was closed as a duplicate of this issue, JBCACHE-56. The closed issue specified that statistics be provided per region. Should the region requirements be specifically incorporated into this issue?

            • 18. Re: Exposing JBossCache Management Attributes
              belaban

              -1 on region based stats. Defer that until 2.x

              • 19. Re: Exposing JBossCache Management Attributes

                After posting on the wrong thread, let me reiterate it properly here :-)

                Why are trying to build a management infrastructure inside the cache?

                The cache is made up of a number of "plugins"/advices that each have their
                own statistics.

                These need to be exposed for management, but how they are
                exposed for management is something that should be solved by the user of the cache
                not the cache itself.

                If you start defining *fat* interfaces on the cache you are making invalid assumptions
                about how the cache is implemented/constructed and losing your ability to change
                it in future.
                e.g. JBoss's EJB container has this problem where the pluggable components (pool/cache)
                are exposed to the jsr77 layer via the EJBContainer.
                It is less of a problem there since jsr77 does at least define some standard statistic
                formats for EJBs.

                In summary, expose the stats as pojos and let a/the management layer deal with
                their exposure/consolidation on a usecase basis.
                Ben got close to this with his initial comment, Manik's "where would it stop?"
                is answered by "where the user wants it to stop", rather than "where you have decided it should stop". :-)

                • 20. Re: Exposing JBossCache Management Attributes

                  We definitely want to avoid fat interfaces, which is one reason why it's undesirable to incorporate the statistics into the existing implementation and mbean.

                  It seems that each interceptor should provide its own statistics if it has any to offer. A new interceptor would be incorporated to handle general cache statistics not specific to other interceptors (e.g., hits, misses, stores).

                  Using dynamic registration of the mbeans (see Bela's reference to the new JGroups registration of protocol mbeans), we can provide multiple mbeans for cache statistics without requiring the user to define any statistical mbeans in the cache configuration. Configuration changes would probably be limited to a boolean flag enabling/disabling statistics gathering.

                  Adrian - re:

                  ...expose the stats as pojos and let a/the management layer deal with
                  their exposure/consolidation on a usecase basis.

                  I'm not clear on what you're proposing here. I think the current vision is that each interceptor would have an associated mbean to expose its statistics. Is this in line with your thinking or are you indicating that interceptors should provide some type of statistics object (unique to each interceptor) that clients could manipulate as desired?






                  • 21. Re: Exposing JBossCache Management Attributes

                     

                    "JerryGauth" wrote:

                    Adrian - re:
                    ...expose the stats as pojos and let a/the management layer deal with
                    their exposure/consolidation on a usecase basis.

                    I'm not clear on what you're proposing here. I think the current vision is that each interceptor would have an associated mbean to expose its statistics. Is this in line with your thinking or are you indicating that interceptors should provide some type of statistics object (unique to each interceptor) that clients could manipulate as desired?


                    I'm saying expose them primarily as POJOs then the user can do what they
                    want with them.
                    If you start imposing your own structure on it too early, you lose flexibility.
                    By all means provide a default, but there can't be a "one size fits all" in such a pluggable
                    framework.

                    It is always easier to build complicated systems from simple primitives.
                    than it is to do it the other way around. :-)

                    e.g.
                    Let the "plugins" worry about maintaining the simple "hits/misses" numbers.
                    Consolidation of data, descriptions, history or average/maximums, etc. is not its concern.

                    On another example how do I plugin an interceptor to rather than measure
                    the plain hit/miss count, I want the "cost" of retrieving data from the cache when I do hit/miss.
                    You can't possibly anticipate all the metrics people can think of exposing,
                    especially when you can't anticipate what "plugins" people will write. :-)

                    • 22. Re: Exposing JBossCache Management Attributes
                      belaban

                      So we simply maintain the state for statistics that cannot be generated, like number of bytes sent, hit/miss ratios etc, in each interceptor.
                      Then another subsystem exposes them, e.g. similar to what I do in JGroups. That subsystem could for example generate an MBean, which exposes *all* attrs/operations in one bean.
                      So by default we'd provide such a management subsystem, which for example exposes the cache and all interceptors in the same hierarchical manner JGroups does it. However, this can be replaced, for example by JBossNetwork.
                      This doesn't necessarily need to be a callback, it can simpy be a method that is called or not by the management subsystem.

                      • 23. Re: Exposing JBossCache Management Attributes

                        Now I finally know where the reference of "fat interface" come from? :-)

                        I think what we should strive for is defining first and foremost a good (or proper) management "framework" for JBoss Cache.

                        Like I mentioned, I like the idea of interceptor based MBean since we are moving toward interceptor pattern anyway. So we should borrow Bela's idea from JGroups. And then, among each interceptor, it is probably their own responsibility to provide different stats based on different provider (and this can be hierarchical). Again, example like eviction or cache loader all have different providers.

                        Like Adrian mentioned, it is the management caller's responsbility to aggregate all these information. But the very least, we will have hierarchy of mbeans.

                        Finally, the concept of region in 2.0 is just like multiple sub-cache instances. So instead of multiple cache instances that we use now inside JBoss AS, we will have just one that have multiple regions, so to speak.

                        Impact on management? To me it is just one more hierarchical layer in the future.

                        • 24. Re: Exposing JBossCache Management Attributes

                          Resurrecting this discussion so that we can move forward. For the initial implementation, I'd like to propose the following which is based in part on the JGroups mbean implementation.

                          1) One mbean per interceptor. The mbean will be registered dynamically and is optional. If an interceptor doesn't provide a corresponding mbean, it won't expose its management characteristics. How to detect whether the mbean exists has to be resolved.

                          2) One new interceptor that captures base statistics such as hits and misses. This will minimize any changes to the existing TreeCache and TreeCacheMbean classes. This mbean will also be dynamically registered so that users don't have to explicitly configure any mbeans.

                          3) A new attribute on the existing TreeCache mbean that specifies whether statistics should be maintained. If this attribute is false, no mbeans will be registered. If true, the base statistics mbean will be registered along with any interceptors that provide mbeans.

                          4) One issue to consider is whether individual interceptors should expose an attribute that allows statistics gathering to be enabled or disabled. This is similar to what the JGroups protocol mbeans provide. However the protocol mbeans have an associated configuration where this can be set initially while there is no comparable configuration for cache interceptors. Any thoughts on whether it would be worthwhile to provide this granularity in the initial implementation?

                          5) The JGroups mbean implementation uses a new set of classes so that existing protocols don't have to implement mbean interfaces. This approach can be used for cache interceptor mbeans or we can determine dynamically whether a cache interceptor implements an mbean interface. Thoughts on whether it would be acceptable to modify cache interceptors to provide mbeans if they want to do so?

                          • 25. Re: Exposing JBossCache Management Attributes
                            belaban

                            I think in this case we can have the interceptors implement MBeans, because we're already using JMX.
                            However, as Adrian previously pointed out, the code that creates the management info and exposes it, should be separate from the code that provides management info.
                            So, like in JGroups, maybe a static method that creates the MBean for the TreeCache(Aop) and 1 for each interceptor.

                            • 26. Re: Exposing JBossCache Management Attributes

                              Jerry,

                              To answer some of your questions. How about we do this?

                              Define an TreeCacheInterceptorBaseMBean interface that looks like:

                              Interface TreeCacheInterceptorBaseMBean
                              {
                              void statsCollection(boolean true);
                              }

                              And we define in TreeCache, an andditional API called:

                              registerMBean(TreeCacheInterceptorBaseMBean mbean)

                              Then if an interceptor wishes to add itself to the management hierarchy, he calls this api (after he implements the BaseMBean). Of course, the flag of stats collection should still applies.

                              This way we get a cleaner hierarhcy that TreeCache has control over.


                              • 27. Re: Exposing JBossCache Management Attributes

                                Naming of the interceptor mbeans
                                Since each treecache instance already has its own primary mbean (e.g., jboss.cache:service=TomcatClusteringCache), we'll need to incorporate the existing service name into each interceptor's mbean name to provide for hierarchical association.

                                So if the TomcatClusteringCache instance has a replication interceptor for which an mbean has been provided, the mbean will be displayed hierarchically with the following name:
                                jboss.cache:service=TomcatClusteringCache,interceptor=ReplicationInterceptor


                                • 28. Re: Exposing JBossCache Management Attributes

                                  +1

                                  • 29. Re: Exposing JBossCache Management Attributes
                                    manik

                                    +1 as well