简体   繁体   English

JMX中MBean的最大数量

[英]Maximum number of MBeans in JMX

Is there a maximum number of MBeans a JMX application can support? JMX应用程序可以支持的MBean数量上限吗? If there is, what is that? 如果有,那是什么?

Thanks in advance. 提前致谢。

不,您仅受分配给JVM的堆的限制。

I work with a rather large application that is multi tenant. 我使用的是一个多租户的大型应用程序。 We changed our interaction with a library and we end up with several MBeans per tenant. 我们更改了与库的交互,最终每个租户得到几个MBean。 This lead to lots of MBean registrations (tens of thousands). 这导致大量的MBean注册(数万个)。 We observed that this starts hockey sticks pretty fast in terms of time to register a bean(at 2,000 it takes a couple of seconds). 我们观察到,在开始注册一个bean的时间方面,曲棍球棒的启动速度非常快(2,000个曲棍球需要几秒钟)。 We observed a lot of thread blocking within mbean registration, specifically: 我们在mbean注册中观察到很多线程阻塞,特别是:

  • com.sun.jmx.mbeanserver.Repository.contains(ObjectName):461 com.sun.jmx.mbeanserver.Repository.contains(ObjectName):461
  • com.sun.jmx.mbeanserver.Repository.addAllMatching(Map, Set, ObjectNamePattern):229 com.sun.jmx.mbeanserver.Repository.addAllMatching(Map,Set,ObjectNamePattern):229
  • com.sun.jmx.mbeanserver.Repository.addMBean(DynamicMBean, ObjectName, RegistrationContext):415 com.sun.jmx.mbeanserver.Repository.addMBean(DynamicMBean,ObjectName,RegistrationContext):415
  • com.sun.jmx.mbeanserver.Repository.ObjectNamePattern.matchKeys(ObjectName):190 com.sun.jmx.mbeanserver.Repository.ObjectNamePattern.matchKeys(ObjectName):190

The addAllMatching and matchKeys appear to iterate through all entries, rather than use a Map.get . addAllMatchingmatchKeys似乎要遍历所有条目,而不是使用Map.get The other two are lock acquires or synchronization. 另外两个是锁获取或同步。

We had plenty of free heap, and CPU usage was nominal (3-5%). 我们有大量的可用堆,并且CPU使用率是名义上的(3-5%)。 Other parts of our application behaved normally. 我们应用程序的其他部分运行正常。 In short, there's contention around creating MBeans, as the number of MBeans grow, in an exponential fashion. 简而言之,随着MBean的数量呈指数增长,创建MBean一直存在争议。 All this was on JDK 11. 所有这些都在JDK 11上进行。

What's worse, we disabled JMX and the issue persisted. 更糟糕的是,我们禁用了JMX,问题仍然存在。 The solution involved ensuring that the library did not attempt to register mbeans through configuration. 解决方案涉及确保库不尝试通过配置注册mbean。

In short: yes it becomes impractical to add MBeans after ~2000. 简而言之:是的,在2000年之后添加MBean变得不切实际。 I've not tested this on diverse environments, so individual experiences may vary. 我尚未在多种环境下进行测试,因此个人体验可能会有所不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM