概述
squbs-actormonitor 模块在actor系统中为每一个actor进行监控。对于大量的actor,这可能会引起干扰。通过application.conf可以配置监控的actor数目。在生产中使用附加此模块的判断。此模块没有用户 API。
依赖
在build.sbt 或Scala构建文件添加如下依赖:
"org.squbs" %% "squbs-actormonitor" % squbsVersion
监控
每一个actor都有一个相关的JMXBean(org.squbs.unicomplex:type=ActorMonitor,name=%actorPath)来公开actor信息:
trait ActorMonitorMXBean {
def getActor: String
def getClassName: String
def getRouteConfig : String
def getParent: String
def getChildren: String
def getDispatcher : String
def getMailBoxSize : String
}
配置
下面是squbs-actormonitor的配置项:
squbs-actormonitor = {
maxActorCount = 500
maxChildrenDisplay = 20
}
JMX Beanorg.squbs.unicomplex:type=ActorMonitor公开了Actor监控的配置。JMX Bean是只读的。
trait ActorMonitorConfigMXBean {
def getCount : Int //Count of JMX bean has been created
def getMaxCount: Int //Maximum JMX bean can be created
def getMaxChildrenDisplay: Int //Per each actor, maximum children can be exposed
}