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. 客户端效果




相关文章
|
8月前
|
存储 弹性计算 缓存
阿里云服务器ECS实例选型与性能监控指南:从场景匹配到优化参考
随着云服务器的普及应用,越来越多的企业和个人用户选择将业务迁移到云端,以享受其带来的灵活性、可扩展性和成本效益。阿里云服务器(Elastic Compute Service,简称ECS)以其丰富的实例规格、卓越的性能和稳定的运行环境,赢得了广大用户的信赖。然而,对于很多初次接触云服务器产品的新手用户来说,面对阿里云多达几十种的云服务器实例规格,往往感到无从下手,不知道如何选择最适合自己业务需求的实例规格。本文旨在通过详细解析阿里云ECS实例规格的选择策略,并介绍如何有效监控云服务器性能,确保业务的高效运行。
481 63
|
5月前
|
弹性计算 安全 Linux
阿里云服务器ECS安装宝塔Linux面板、安装网站(新手图文教程)
本教程详解如何在阿里云服务器上安装宝塔Linux面板,涵盖ECS服务器手动安装步骤,包括系统准备、远程连接、安装命令执行、端口开放及LNMP环境部署,手把手引导用户快速搭建网站环境。
|
6月前
|
监控 Linux 网络安全
FinalShell SSH工具下载,服务器管理,远程桌面加速软件,支持Windows,macOS,Linux
FinalShell是一款国人开发的多平台SSH客户端工具,支持Windows、Mac OS X和Linux系统。它提供一体化服务器管理功能,支持shell和sftp同屏显示,命令自动提示,操作便捷。软件还具备加速功能,提升访问服务器速度,适合普通用户和专业人士使用。
1821 0
|
8月前
|
关系型数据库 MySQL Java
安装和配置JDK、Tomcat、MySQL环境,以及如何在Linux下更改后端端口。
遵循这些步骤,你可以顺利完成JDK、Tomcat、MySQL环境的安装和配置,并在Linux下更改后端端口。祝你顺利!
501 11
|
8月前
|
数据挖掘 Linux 数据库
服务器数据恢复—Linux系统服务器数据恢复案例
服务器数据恢复环境: linux操作系统服务器中有一组由4块SAS接口硬盘组建的raid5阵列。 服务器故障: 服务器工作过程中突然崩溃。管理员将服务器操作系统进行了重装。 用户方需要恢复服务器中的数据库、办公文档、代码文件等。
|
9月前
|
JavaScript Linux Python
在Linux服务器中遇到的立即重启后的绑定错误:地址已被使用问题解决
总的来说,解决"地址已被使用"的问题需要理解Linux的网络资源管理机制,选择合适的套接字选项,以及合适的时间点进行服务重启。以上就是对“立即重启后的绑定错误:地址已被使用问题”的全面解答。希望可以帮你解决问题。
462 20
|
10月前
|
存储 运维 监控
深度体验阿里云系统控制台:SysOM 让 Linux 服务器监控变得如此简单
作为一名经历过无数个凌晨三点被服务器报警电话惊醒的运维工程师,我对监控工具有着近乎苛刻的要求。记得去年那次大型活动,我们的主站流量暴增,服务器内存莫名其妙地飙升到90%以上,却找不到原因。如果当时有一款像阿里云 SysOM 这样直观的监控工具,也许我就不用熬通宵排查问题了。今天,我想分享一下我使用 SysOM 的亲身体验,特别是它那令人印象深刻的内存诊断功能。
370 1
|
10月前
|
Linux 虚拟化 Docker
Linux服务器部署docker windows
在当今软件开发中,Docker成为流行的虚拟化技术,支持在Linux服务器上运行Windows容器。流程包括:1) 安装Docker;2) 配置支持Windows容器;3) 获取Windows镜像;4) 运行Windows容器;5) 验证容器状态。通过这些步骤,你可以在Linux环境中顺利部署和管理Windows应用,提高开发和运维效率。
1506 1
|
12月前
|
安全 大数据 Linux
云上体验最佳的服务器操作系统 - Alibaba Cloud Linux | 飞天技术沙龙-CentOS 迁移替换专场
本次方案的主题是云上体验最佳的服务器操作系统 - Alibaba Cloud Linux ,从 Alibaba Cloud Linux 的产生背景、产品优势以及云上用户使用它享受的技术红利等方面详细进行了介绍。同时,通过国内某社交平台、某快递企业、某手机客户大数据业务 3 大案例,成功助力客户实现弹性扩容能力提升、性能提升、降本增效。 1. 背景介绍 2. 产品介绍 3. 案例分享
301 1
|
存储 Oracle 安全
服务器数据恢复—LINUX系统删除/格式化的数据恢复流程
Linux操作系统是世界上流行的操作系统之一,被广泛用于服务器、个人电脑、移动设备和嵌入式系统。Linux系统下数据被误删除或者误格式化的问题非常普遍。下面北亚企安数据恢复工程师简单聊一下基于linux的文件系统(EXT2/EXT3/EXT4/Reiserfs/Xfs) 下删除或者格式化的数据恢复流程和可行性。