jprofile远程监控JVM(springboot项目)
2019-08-01 16:29
477 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_44096512/article/details/98062684
jprofile 安装
-
Linux服务器安装
官网地址,选择:
下载后上传到被测服务器的/opt 下,解压,重命名为:jprofiler11 -
本机安装客户端
mac破解版下载地址
按照网页上的教程下载安装即可。
配置及启动
- 服务器端配置
- 配置/etc/profile文件,添加如下内容
export INSTALL4J_JAVA_HOME=/server/jdk1.8.0_151/jre #jdk安装目录下 export LD_LIBRARY_PATH=/opt/jprofiler11/bin/linux-x86 #jprofile的安装目录下
然后source一下,使立即生效:
# source /etc/profile
- 进入/opt/jprofiler11/bin目录,执行:
# sudo -u tomcat /opt/jprofiler11/bin/jpenable
如果出现如下报错:
No suitable Java Virtual Machine could be found on your system. The version of the JVM must be at least 1.6 and at most 11. Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
需要修改jpenable文件,执行:vim jpenable 编辑文件,修改后如下:
# Uncomment the following line to override the JVM search sequence INSTALL4J_JAVA_HOME_OVERRIDE=/server/jdk1.8.0_151/ # Uncomment the following line to add additional VM parameters # INSTALL4J_ADD_VM_PARAMS=
再次执行,成功。先选择mode:1,然后输入连接端口号:8849:
# sudo -u tomcat /opt/jprofiler11/bin/jpenableConnecting to /server/application/xw-web/ef9c48.../jprofiler11/bin/agent.jar [20480] ... Please select the profiling mode: GUI mode (attach with JProfiler GUI) [1, Enter] Offline mode (use config file to set profiling settings) [2] 1 Please enter a profiling port [35634] 8849 You can now use the JProfiler GUI to connect on port 8849
- 服务启动时需要添加jprofile的配置:-agentlib:jprofilerti=port=8849 -Xbootclasspath/a:/opt/jprofiler11/bin/agent.jar
//先查询出项目启动进程并杀死 # ps -ef | grep /server/application/xw-web |grep -v grep|grep tomcat|awk '{print $2}' 19205 # kill -s 9 19205 //进入项目包存放目录,执行启动命令 # su - tomcat -c 'nohup java -Dserver.port=8080 -server -Xms256M -Xmx512M -Xmn128M -XX:MetaspaceSize=128M -XX:MaxMetaspaceSize=256M -Xss512k -XX:+DisableExplicitGC -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=10 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:LargePageSizeInBytes=128M-XX:+UseFastAccessorMethods -XX:CMSInitiatingOccupancyFraction=70 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/server/application/xw-web/logs/ -Djava.io.tmpdir=/server/application/xw-web/temp -Dspring.profiles.active=perf -jar /server/application/xw-web/ef9c483.jar>>/server/application/xw-web/logs/catalina.out -agentlib:jprofilerti=port=8849 -Xbootclasspath/a:/opt/jprofiler11/bin/agent.jar 2>&1 &'
- 客户端配置
具体操作如下图:
配置完成后,即可看到服务器上的监控数据:
相关文章推荐
- spring boot项目打包加jvm设置启动
- java架构师、集群、高可扩展、高性能、高并发、性能优化、Spring boot、Dubbo、Redis、ActiveMQ、Nginx、Mycat、Netty、Jvm大型分布式项目实战学习架构师之路
- 基于maven的spring boot项目 部署到tomcat出现js文件失效处理思路总结
- spring boot 项目打包jar 启动方式,以及 可能遇到的坑。
- SpringBoot与SSM的区别,新建及运行SpringBoot项目
- springboot项目maven打包分离lib包
- weblogic部署springboot项目中的问题
- 基于Maven的Springboot项目搭建学习笔记
- Springboot项目部署到外置Tomcat
- 一个非常简单的spring-boot web项目(一)
- [置顶] spring boot项目实战:跨域问题解决
- 关于更换spring boot项目启动占用的端口号为非8080的
- Linux/Unix下Spring Boot项目开机自启
- IDEA创建SpringBoot项目简单实例
- 将SpringBoot项目搭载在腾讯云服务器上并一直运行
- 只需两步实现Eclipse+Maven快速构建第一个Spring Boot项目
- spring boot最小web项目
- IDEA搭建Springboot项目
- SpringBoot项目将外部依赖包 通过install 打包
- springboot项目 同时支持http、https