JProfiler10.1.3:远程Linux服务器Tomcat的JVM性能监控

简介: JProfiler10.1.3:远程Linux服务器Tomcat的JVM性能监控

JProfiler安装


环境

  • Centos Linux 7.4
  • tomcat 8.0、jdk1.8.0_181
  • jprofiler_linux_10_1_3.tar.gz
  • jprofiler_windows-x64_10_1_3


下载软件

官网地址:http://www.ej-technologies.com/download/jprofiler/files ,一个linux服务端,一个windows客户端 GUI界面

linux版本要和windows版保持一致


Linux服务器安装

1、下载好后把tar包上传的linux服务器,解压。

安装目录  /usr/local/jprofiler/

tar -zvxf jprofiler_linux_10_1_3.tar.gz

2,修改tomcat配置

进入tomcat的bin目录,修改startup.sh文件,在文件开始增加如下配置:

JAVA_OPTS='-Xms256m -Xmx1024mm'

CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS -agentpath:/usr/local/jprofiler/jprofiler10.1.3/bin/linux-x64/libjprofilerti.so=port=8849,nowait"

export CATALINA_OPTS

  • 修改后的startup.sh文件,完整如下
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------------
# Start Script for the CATALINA Server
# -----------------------------------------------------------------------------
JAVA_OPTS='-Xms256m -Xmx1024mm'
CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS -agentpath:/usr/local/jprofiler/jprofiler10.1.3/bin/linux-x64/libjprofilerti.so=port=8849,nowait"
export CATALINA_OPTS
# Better OS/400 detection: see Bugzilla 31132
os400=false
case "`uname`" in
OS400*) os400=true;;
esac
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done
PRGDIR=`dirname "$PRG"`
EXECUTABLE=catalina.sh
# Check that target executable exists
if $os400; then
  # -x will Only work on the os400 if the files are:
  # 1. owned by the user
  # 2. owned by the PRIMARY group of the user
  # this will not work if the user belongs in secondary groups
  eval
else
  if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
    echo "Cannot find $PRGDIR/$EXECUTABLE"
    echo "The file is absent or does not have execute permission"
    echo "This file is needed to run this program"
    exit 1
  fi
fi
exec "$PRGDIR"/"$EXECUTABLE" start "$@"


3、再重启tomcat

可以看到8849端口启动成功了。


Windows客户端安装

jprofiler_windows-x64_10_1_3.exe,直接安装,选择自定义安装位置即可


连接linux监控Tomcat运行状态

1. New Remote Integration

打开jprofiler程序,在Session菜单中打开“Integration Wizards”,选择“New Remote Integration”,打开配置对话框。


2. 选择部署的容器

在面板中显示出了所有支持可以监视的多种服务器类型,包括Tomcat、Resin等。

因为我们使用Tomcat8.0部署web应用,所以我们选择Apache Tomcat 8.x,并点击下一步。


3. 选择JDK版本

 

4. 选择启动监控的方式

对连接的时机控制有以下三种:

等待模式 wait for a connection from the Jprofiler GUI

  • 此模式为在启动容器Weblogic/Tomcat时,需要等Jprofiler连接后才能启动,JVM TI是采用事件通知方式告知JProfiler相关的Jvm的状态变化,等待模式可以不漏掉通知

非等待模式 Start Immeditely

  • 此模式下容器Weblogic/Tomcat独立启动,Jprofiler随时可以连接。

离线模式 Profile offline, Jprofiler GUI cannot connect

  • 此模式为离线模式,生成相关记录文件事后分析。


5. 设置远程Linux服务器地址


6. 设置linux中jprofiler安装路径

 

7. 选择容器启动脚本

  • Tomat容器的启动可以由jprofiler来控制,jprofiler要修改启动文件加入JVM TI参数实现监视目的。
  • 选择好Tomat启动脚本后,jprofiler会自动为我们生成新的启动脚本,文件名是startup_jprofiler.sh,通过这个文件来启动Tomcat。
  • 启动脚本,必须来自远程服务器中的startup.sh。这个启动脚本,必须能够访问,所以需要从远程服务器拷贝到本地一份,或者在远程服务器挂载一个可写的驱动。
  • 这里,我拷贝到 D:\Java\jprofiler\back\test\CloudPayment

  • 选择好Tomat启动脚本后,jprofiler会自动为我们生成新的启动脚本,文件名是startup_jprofiler.sh

  • startup_jprofiler.sh内容
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------------
# Start Script for the CATALINA Server
# -----------------------------------------------------------------------------
JAVA_OPTS='-Xms256m -Xmx1024mm'
CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS -agentpath:/usr/local/jprofiler/jprofiler10.1.3/bin/linux-x64/libjprofilerti.so=port=8849,nowait"
export CATALINA_OPTS
# Better OS/400 detection: see Bugzilla 31132
os400=false
case "`uname`" in
OS400*) os400=true;;
esac
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done
PRGDIR=`dirname "$PRG"`
EXECUTABLE=catalina.sh
# Check that target executable exists
if $os400; then
  # -x will Only work on the os400 if the files are:
  # 1. owned by the user
  # 2. owned by the PRIMARY group of the user
  # this will not work if the user belongs in secondary groups
  eval
else
  if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
    echo "Cannot find $PRGDIR/$EXECUTABLE"
    echo "The file is absent or does not have execute permission"
    echo "This file is needed to run this program"
    exit 1
  fi
fi
# The following lines have been added by the
# application server integration wizard of JProfiler
CATALINA_OPTS="-agentpath:/usr/local/jprofiler/jprofiler10.1.3/bin/linux-x64/libjprofilerti.so=port=8849 $CATALINA_OPTS"
export CATALINA_OPTS
# end of modifications
exec "$PRGDIR"/"$EXECUTABLE" run "$@"


8. 选择启动端口

和startup.sh中添加的内容,保持一致


9. 查看配置汇总信息

信息的内容说

创建了一个启动脚本startup_jprofiler.sh,在相同的目录里。可以用它的来启动。

其中添加了CATALINA_OPTS参数,别被你人为的覆盖了。


10. 创建完成


11. 客户端效果




目录
相关文章
|
2天前
|
关系型数据库 应用服务中间件 Linux
Linux云服务器如何搭建LNMP环境
LNMP环境是Linux系统中常用的Web服务架构,由Linux、Nginx、MySQL/MariaDB和PHP组成,适用于高效托管动态网站。本文以CentOS 7为例,详细介绍了LNMP环境的搭建步骤,包括Nginx、MariaDB和PHP的安装与配置,以及最终通过创建`index.php`文件验证环境是否成功部署。具体操作涵盖配置YUM仓库、安装服务、编辑配置文件、启动服务等关键步骤,确保用户能够顺利搭建并运行LNMP环境。
25 1
Linux云服务器如何搭建LNMP环境
|
1月前
|
安全 大数据 Linux
云上体验最佳的服务器操作系统 - Alibaba Cloud Linux | 飞天技术沙龙-CentOS 迁移替换专场
本次方案的主题是云上体验最佳的服务器操作系统 - Alibaba Cloud Linux ,从 Alibaba Cloud Linux 的产生背景、产品优势以及云上用户使用它享受的技术红利等方面详细进行了介绍。同时,通过国内某社交平台、某快递企业、某手机客户大数据业务 3 大案例,成功助力客户实现弹性扩容能力提升、性能提升、降本增效。 1. 背景介绍 2. 产品介绍 3. 案例分享
|
2月前
|
运维 监控 Linux
推荐几个不错的 Linux 服务器管理工具
推荐几个不错的 Linux 服务器管理工具
207 6
W9
|
3月前
|
运维 关系型数据库 MySQL
轻松管理Linux服务器的5个优秀管理面板
Websoft9 应用管理平台,github 2k star 开源软件,既有200+的优秀开源软件商店,一键安装。又有可视化的Linux管理面板,文件、数据库、ssl证书方便快捷管理。
W9
384 1
|
3月前
|
缓存 Ubuntu Linux
Linux环境下测试服务器的DDR5内存性能
通过使用 `memtester`和 `sysbench`等工具,可以有效地测试Linux环境下服务器的DDR5内存性能。这些工具不仅可以评估内存的读写速度,还可以检测内存中的潜在问题,帮助确保系统的稳定性和性能。通过合理配置和使用这些工具,系统管理员可以深入了解服务器内存的性能状况,为系统优化提供数据支持。
140 4
|
3月前
|
运维 监控 安全
盘点Linux服务器运维管理面板
随着云计算和大数据技术的迅猛发展,Linux服务器在运维管理中扮演着越来越重要的角色。传统的Linux服务器管理方式已经无法满足现代企业的需求,因此,高效、安全、易用的运维管理面板应运而生。
|
3月前
|
运维 监控 Linux
服务器管理面板大盘点: 8款开源面板助你轻松管理Linux服务器
在数字化时代,服务器作为数据存储和计算的核心设备,其管理效率与安全性直接关系到业务的稳定性和可持续发展。随着技术的不断进步,开源社区涌现出众多服务器管理面板,这些工具以其强大的功能、灵活的配置和友好的用户界面,极大地简化了Linux服务器的管理工作。本文将详细介绍8款开源的服务器管理面板,包括Websoft9、宝塔、cPanel、1Panel等,旨在帮助运维人员更好地选择和使用这些工具,提升服务器管理效率。
|
2月前
|
存储 Oracle 安全
服务器数据恢复—LINUX系统删除/格式化的数据恢复流程
Linux操作系统是世界上流行的操作系统之一,被广泛用于服务器、个人电脑、移动设备和嵌入式系统。Linux系统下数据被误删除或者误格式化的问题非常普遍。下面北亚企安数据恢复工程师简单聊一下基于linux的文件系统(EXT2/EXT3/EXT4/Reiserfs/Xfs) 下删除或者格式化的数据恢复流程和可行性。
|
3月前
|
安全 Linux API
Linux服务器安全
人们常误认为服务器因存于数据中心且数据持续使用而无需加密。然而,当驱动器需维修或处理时,加密显得尤为重要,以防止数据泄露。Linux虽有dm-crypt和LUKS等内置加密技术,但在集中管理、根卷加密及合规性等方面仍存不足。企业应选择具备强大验证、简单加密擦除及集中管理等功能的解决方案,以弥补这些缺口。
77 0