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




相关文章
|
7月前
|
存储 弹性计算 缓存
阿里云服务器ECS实例选型与性能监控指南:从场景匹配到优化参考
随着云服务器的普及应用,越来越多的企业和个人用户选择将业务迁移到云端,以享受其带来的灵活性、可扩展性和成本效益。阿里云服务器(Elastic Compute Service,简称ECS)以其丰富的实例规格、卓越的性能和稳定的运行环境,赢得了广大用户的信赖。然而,对于很多初次接触云服务器产品的新手用户来说,面对阿里云多达几十种的云服务器实例规格,往往感到无从下手,不知道如何选择最适合自己业务需求的实例规格。本文旨在通过详细解析阿里云ECS实例规格的选择策略,并介绍如何有效监控云服务器性能,确保业务的高效运行。
450 63
|
7月前
|
Java 关系型数据库 MySQL
在Linux平台上进行JDK、Tomcat、MySQL的安装并部署后端项目
现在,你可以通过访问http://Your_IP:Tomcat_Port/Your_Project访问你的项目了。如果一切顺利,你将看到那绚烂的胜利之光照耀在你的项目之上!
401 41
|
7月前
|
开发框架 Java 关系型数据库
在Linux系统中安装JDK、Tomcat、MySQL以及部署J2EE后端接口
校验时,浏览器输入:http://[your_server_IP]:8080/myapp。如果你看到你的应用的欢迎页面,恭喜你,一切都已就绪。
521 17
|
7月前
|
Java 关系型数据库 MySQL
在Linux操作系统上设置JDK、Tomcat、MySQL以及J2EE后端接口的部署步骤
让我们总结一下,给你的Linux操作系统装备上最强的军队,需要先后装备好JDK的弓箭,布置好Tomcat的阵地,再把MySQL的物资原料准备好,最后部署好J2EE攻城车,那就准备好进军吧,你的Linux军团,无人可挡!
164 18
|
7月前
|
关系型数据库 MySQL Java
安装和配置JDK、Tomcat、MySQL环境,以及如何在Linux下更改后端端口。
遵循这些步骤,你可以顺利完成JDK、Tomcat、MySQL环境的安装和配置,并在Linux下更改后端端口。祝你顺利!
477 11
|
7月前
|
开发框架 关系型数据库 Java
Linux操作系统中JDK、Tomcat、MySQL的完整安装流程以及J2EE后端接口的部署
然后Tomcat会自动将其解压成一个名为ROOT的文件夹。重启Tomcat,让新“植物”适应新环境。访问http://localhost:8080/yourproject看到你的项目页面,说明“植物”种植成功。
232 10
|
应用服务中间件 Linux 网络安全
|
应用服务中间件 Linux 网络安全
【Azure 应用服务】App Service for Linux 环境中为Tomcat页面修改默认的Azure 404页面
【Azure 应用服务】App Service for Linux 环境中为Tomcat页面修改默认的Azure 404页面
166 5
|
关系型数据库 Java MySQL
Linux安装JDK1.8 & tomcat & MariaDB(MySQL删减版)
本教程提供了在Linux环境下安装JDK1.8、Tomcat和MariaDB的详细步骤。这三个组件的组合为Java Web开发和部署提供了一个强大的基础。通过遵循这些简单的指导步骤,您可以轻松建立起一个稳定、高效的开发和部署环境。希望这个指导对您的开发工作有所帮助。
461 8
|
网络协议 安全 应用服务中间件
在Linux中,Tomcat8005、8009、8080三个端口的含义?
在Linux中,Tomcat8005、8009、8080三个端口的含义?