Jetty监控线程使用情况配置

第一步,配置xml文件

jetty-monitor.xml

参数说明:

threads: 线程池中的线程
busyThreads: 使用中的线程
idleThreads: 空闲的线程
lowOnThreads: 是否达到maxThread并且没有空闲线程接受请求(True if the pools is at maxThreads and there are not idle threads than queued jobs)
queueSize: 排队中的job数
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd"> <Configure id="Monitor" class="org.eclipse.jetty.monitor.JMXMonitor">
<Call name="addActions">
<Arg>
<Array type="org.eclipse.jetty.monitor.jmx.MonitorAction">
<Item>
<New class="org.eclipse.jetty.monitor.jmx.SimpleAction">
<Arg>
<New class="org.eclipse.jetty.monitor.triggers.AttrEventTrigger">
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
</Arg>
<Arg>threads</Arg>
</New>
</Arg>
<Arg>
<New class="org.eclipse.jetty.monitor.jmx.LoggingNotifier">
<Arg>%s</Arg>
</New>
</Arg>
<Arg type="java.lang.Long">1000</Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.monitor.jmx.SimpleAction">
<Arg>
<New class="org.eclipse.jetty.monitor.triggers.AttrEventTrigger">
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
</Arg>
<Arg>busyThreads</Arg>
</New>
</Arg>
<Arg>
<New class="org.eclipse.jetty.monitor.jmx.LoggingNotifier">
<Arg>%s</Arg>
</New>
</Arg>
<Arg type="java.lang.Long">1000</Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.monitor.jmx.SimpleAction">
<Arg>
<New class="org.eclipse.jetty.monitor.triggers.AttrEventTrigger">
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
</Arg>
<Arg>idleThreads</Arg>
</New>
</Arg>
<Arg>
<New class="org.eclipse.jetty.monitor.jmx.LoggingNotifier">
<Arg>%s</Arg>
</New>
</Arg>
<Arg type="java.lang.Long">1000</Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.monitor.jmx.SimpleAction">
<Arg>
<New class="org.eclipse.jetty.monitor.triggers.AttrEventTrigger">
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
</Arg>
<Arg>lowOnThreads</Arg>
</New>
</Arg>
<Arg>
<New class="org.eclipse.jetty.monitor.jmx.LoggingNotifier">
<Arg>%s</Arg>
</New>
</Arg>
<Arg type="java.lang.Long">1000</Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.monitor.jmx.SimpleAction">
<Arg>
<New class="org.eclipse.jetty.monitor.triggers.AttrEventTrigger">
<Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
</Arg>
<Arg>queueSize</Arg>
</New>
</Arg>
<Arg>
<New class="org.eclipse.jetty.monitor.jmx.LoggingNotifier">
<Arg>%s</Arg>
</New>
</Arg>
<Arg type="java.lang.Long">1000</Arg>
</New>
</Item>
</Array>
</Arg>
</Call>
</Configure>

jetty-jmx.xml(保持原样不动即可,以下为参考)

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">

<Configure id="Server" class="org.eclipse.jetty.server.Server">

  <!-- =========================================================== -->
<!-- Get the platform mbean server -->
<!-- =========================================================== -->
<Call id="MBeanServer" class="java.lang.management.ManagementFactory"
name="getPlatformMBeanServer" /> <!-- =========================================================== -->
<!-- Initialize the Jetty MBean container -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
<Arg>
<Ref refid="MBeanServer" />
</Arg>
</New>
</Arg>
</Call> <!-- Add the static log -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.util.log.Log" />
</Arg>
</Call>
</Configure>

第二步,导入xml文件

在jetty.conf中添加以下行:

jetty-monitor.xml
jetty-jmx.xml

第三步,开启对应模块

在start.ini中添加以下行:

--module=monitor
--module=jmx

第四步,重启jetty容器

线程的使用情况会以log的形式展现出来:

2017-01-09 17:24:40.759:INFO:oejmj.LoggingNotifier:pool-1-thread-2: [org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0:idleThreads]=98
Action time: Mon Jan 09 17:24:40 CST 2017
2017-01-09 17:24:40.759:INFO:oejmj.LoggingNotifier:pool-1-thread-4: [org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0:lowOnThreads]=false
Action time: Mon Jan 09 17:24:40 CST 2017
2017-01-09 17:24:40.760:INFO:oejmj.LoggingNotifier:pool-1-thread-1: [org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0:busyThreads]=2
Action time: Mon Jan 09 17:24:40 CST 2017
2017-01-09 17:24:40.760:INFO:oejmj.LoggingNotifier:pool-1-thread-2: [org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0:threads]=100
Action time: Mon Jan 09 17:24:40 CST 2017
2017-01-09 17:24:41.760:INFO:oejmj.LoggingNotifier:pool-1-thread-2: [org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0:idleThreads]=98
Action time: Mon Jan 09 17:24:41 CST 2017
2017-01-09 17:24:41.760:INFO:oejmj.LoggingNotifier:pool-1-thread-1: [org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0:lowOnThreads]=false
Action time: Mon Jan 09 17:24:41 CST 2017
2017-01-09 17:24:41.763:INFO:oejmj.LoggingNotifier:pool-1-thread-4: [org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0:busyThreads]=2
Action time: Mon Jan 09 17:24:41 CST 2017
2017-01-09 17:24:41.763:INFO:oejmj.LoggingNotifier:pool-1-thread-3: [org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0:threads]=100
Action time: Mon Jan 09 17:24:41 CST 2017

Jetty监控线程使用情况的配置的更多相关文章

  1. 开源动态可监控线程池DynamicTp介绍

    前言 使用线程池 ThreadPoolExecutor 过程中你是否有以下痛点呢? 代码中创建了一个 ThreadPoolExecutor,但是不知道那几个核心参数设置多少比较合适 凭经验设置参数值, ...

  2. 通过micrometer实时监控线程池的各项指标

    通过micrometer实时监控线程池的各项指标 前提 最近的一个项目中涉及到文件上传和下载,使用到JUC的线程池ThreadPoolExecutor,在生产环境中出现了某些时刻线程池满负载运作,由于 ...

  3. VS中调试时监控线程的最后错误代码

    进行调试的时候,监控线程的最后错误代码是非常有用的. 在 Microsoft Visual studio 中,Microsoft 的调试程序支持一个非常有用的特性,即可以配置 Watch 窗口,以便始 ...

  4. 【第一章】zabbix3.4监控WindowsCPU使用率磁盘IO磁盘事件日志监控阈值邮件报警详细配置

    Windows安装zabbix-agent 监控Windows-CPU使用率 监控Windows-磁盘IO性能监控 监控Windows/Linux-磁盘触发器阈值更改 监控Windows-网卡自动发现 ...

  5. InnoDB的后台线程(IO线程,master线程,锁监控线程,错误监控线程)和内存(缓冲池,重做日志缓冲池,额外内存池)

    InnoDB有多个内存块,你可以认为这些内存块组成了一个大的内存池,负责如下工作: 维护所有进程/线程需要访问的多个内部数据结构. 缓存磁盘上的数据,方便快速地读取,并且在对磁盘文件的数据进行修改之前 ...

  6. HDFS源码分析数据块复制监控线程ReplicationMonitor(一)

    ReplicationMonitor是HDFS中关于数据块复制的监控线程,它的主要作用就是计算DataNode工作,并将复制请求超时的块重新加入到待调度队列.其定义及作为线程核心的run()方法如下: ...

  7. Python之Monitor监控线程(干货)

    在日常工作中常遇到这样的情况,我们需要一个监控线程用于随时的获得其他进程的任务请求,或者我们需要监视某些资源等的变化,一个高效的Monitor程序如何使用python语言实现呢?为了解决上述问题,我将 ...

  8. (十一)使用Jconsole监控线程

    一.案例 监控线程情况,包括阻塞.死循环等 1.1 代码如下,下述代码共有三个线程,Main.mythread01.mythread02线程,其中mythread01线程为死循环.mythread02 ...

  9. stub_status监控Nginx使用情况!

    stub_status监控Nginx使用情况! 查看nginx安装的模块! # /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.8.1 bu ...

随机推荐

  1. linux下常用基本命令操作

    #fdisk -l 查看硬盘信息 cat /proc/cpuinfo 查看CPU信息 free -m 查看内存信息 ethtool eth0 查看网卡信息 df -h 查看硬盘各分区可用空间大小 ca ...

  2. OD: SafeSEH

    SafeSEH 对异常处理的保护原理 在 Windows XP sp2 以及之后的版本中,微软引入了 S.E.H 校验机制 SafeSEH.SafeSEH 需要 OS 和 Compiler 的双重支持 ...

  3. php正则表达式总结

    <?php echo 'wj'; echo '<br>'; $file = '<td>移动150卡</td><!--<td></td& ...

  4. (转)jQuery LigerUI 插件介绍及使用之ligerTree

    一,简介  ligerTree的功能列表: 1,支持本地数据和服务器数据(配置data或者url) 2,支持原生html生成Tree 3,支持动态获取增加/修改/删除节点 4,支持大部分常见的事件 5 ...

  5. Windows Server 2008关闭internet explorer增强的安全配置

    服务器系统要求很高的安全性,所以微软给ie添加了安全增强.这就使得ie在Internet区域的安全级别一直是最高的,而且无法进行整体调整. 关闭IE SEC服务器系统要求很高的安全性,所以微软给ie添 ...

  6. 认识html标签

    让我们通过一个网页的学习,来对html标签有一个初步理解. 平常大家说的上网就是浏览各种各式各样的网页,这些网页都是由html标签组成的. 下面就是一个简单的网页.效果图如下: 我们来分析一下,这个网 ...

  7. PHP 初学者的学习线路和建议【1】

    先来看下PHP初学者的学习线路: (1) 熟悉HTML/CSS/JS等网页基本元素,完成阶段可自行制作简单的网页,对元素属性相对熟悉. (2) 理解动态语言的概念和运做机制,熟悉基本的PHP语法. ( ...

  8. Zend Framework

    参考:http://www.php100.com/manual/ZendFramework/index.html 1.1. 概述 Zend Framework (ZF) 是一个开放源代码的 PHP5 ...

  9. WPFPath素材

    放在Viewbox中可固定比例 <!--五角星--> <Canvas Width="100" Height="100"> <Pat ...

  10. 用dup2和dup产生一份file descriptor 的拷贝

    在类Unix操作系统里面,.dup2和dup都通过系统调用来产生一份file descriptor 的拷贝.   dup对我来说还很简单   int dup(int filedes);   dup2就 ...