性能测试-CPU性能分析,用户态us高,初步定位到代码行

news2024/10/7 16:22:00

监控工具安装

Grafana:安装请看我上一篇文章性能测试-JMeter influxdb grafana性能测试监控平台-食用指南_Tommy.IT的博客-CSDN博客JMeter测试脚本跑起来,在influxdb服务看看数据里面的数据,原来influxdb的jmeter库里面没有表,当JMeter脚本运行的时候,influxdb会自动创建好表并有数据写入。grafana influxdb模板id:5496,可以下载为json,在grafana里面再导入也可以。成功打开grafana首页,提示一下如果进入不了,要关闭linux的防火墙。添加模板页面:数据库名称:influxdb,其他默认,点击import。measurements:jmeter,表的名字,默认。https://blog.csdn.net/qq_30864373/article/details/127736953

node_exporter:Download | Prometheus

node_exporter-1.4.0.linux-amd64.tar.gz

在被监控的机器上面安装,多台服务器的话,就安装多个node_exporter,并启动完成

启动node_exporter:[root@centos7 node_exporter-1.4.0.linux-amd64]# nohup ./node_exporter &

[root@centos7 node_exporter-1.4.0.linux-amd64]# nohup node_exporter &
[1] 30117


[root@centos7 node_exporter-1.4.0.linux-amd64]# nohup: 忽略输入并把输出追加到"nohup.out"


nohup: 无法运行命令"node_exporter": 没有那个文件或目录


无法运行命令"node_exporter": 没有那个文件或目录:通常应该是有重复开启了,先查询一下

ps -ef |grep node

prometheus:https://github.com/prometheus/prometheus/releases/download/v2.40.3/prometheus-2.40.3.linux-amd64.tar.gz

prometheus-2.40.3.linux-amd64.tar.gz ,解压后,需要修改prometheus.yml文件,修改的时候需要注意job_name与static_configs之间的缩进,不然会报错的!

yaml: unmarshal errors:\n  line 30: field static_configs already set in type config.ScrapeConfig\n  line 33: field static_configs already set in type config.ScrapeConfig

 prometheus.yml文件修改如下,配置要监听的服务器地址,如果有多个服务器地址: - targets: ["l192.168.1.156:9100",192.168.1.157:9200]

    static_configs:
      - targets: ["localhost:9090"]

  - job_name: "node"
    static_configs:
      - targets: ["192.168.1.156:9100"]

  - job_name: "jvm"  
    static_configs:
      - targets: ["192.168.1.156:3388"]

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]

  - job_name: "node"
    static_configs:
      - targets: ["192.168.1.156:9100"]

  - job_name: "jvm"  
    static_configs:
      - targets: ["192.168.1.156:3388"]

 编辑完prometheus.yml后,启动prometheus,没有报错就可以了,用nohup ./prometheus & 后台启动

[root@centos7 prometheus-2.40.3.linux-amd64]# vim ./prometheus.yml
[root@centos7 prometheus-2.40.3.linux-amd64]# ./prometheus
ts=2022-11-27T18:14:06.505Z caller=main.go:512 level=info msg="No time or size retention was set so using the default time retention" duration=15d
ts=2022-11-27T18:14:06.505Z caller=main.go:556 level=info msg="Starting Prometheus Server" mode=server version="(version=2.40.3, branch=HEAD, revision=84e95d8cbc51b89f1a69b25dd239cae2a44cb6c1)"
ts=2022-11-27T18:14:06.505Z caller=main.go:561 level=info build_context="(go=go1.19.3, user=root@72aff466572b, date=20221124-09:08:44)"
ts=2022-11-27T18:14:06.505Z caller=main.go:562 level=info host_details="(Linux 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 centos7 (none))"
ts=2022-11-27T18:14:06.505Z caller=main.go:563 level=info fd_limits="(soft=4096, hard=4096)"
ts=2022-11-27T18:14:06.505Z caller=main.go:564 level=info vm_limits="(soft=unlimited, hard=unlimited)"
ts=2022-11-27T18:14:06.506Z caller=web.go:559 level=info component=web msg="Start listening for connections" address=0.0.0.0:9090
ts=2022-11-27T18:14:06.507Z caller=main.go:993 level=info msg="Starting TSDB ..."
ts=2022-11-27T18:14:06.509Z caller=head.go:562 level=info component=tsdb msg="Replaying on-disk memory mappable chunks if any"
ts=2022-11-27T18:14:06.509Z caller=head.go:606 level=info component=tsdb msg="On-disk memory mappable chunks replay completed" duration=4.645µs
ts=2022-11-27T18:14:06.509Z caller=head.go:612 level=info component=tsdb msg="Replaying WAL, this may take a while"
ts=2022-11-27T18:14:06.512Z caller=tls_config.go:232 level=info component=web msg="Listening on" address=[::]:9090
ts=2022-11-27T18:14:06.512Z caller=tls_config.go:235 level=info component=web msg="TLS is disabled." http2=false address=[::]:9090
ts=2022-11-27T18:14:06.513Z caller=head.go:683 level=info component=tsdb msg="WAL segment loaded" segment=0 maxSegment=1
ts=2022-11-27T18:14:06.514Z caller=head.go:683 level=info component=tsdb msg="WAL segment loaded" segment=1 maxSegment=1
ts=2022-11-27T18:14:06.514Z caller=head.go:720 level=info component=tsdb msg="WAL replay completed" checkpoint_replay_duration=14.183µs wal_replay_duration=4.687682ms wbl_replay_duration=121ns total_replay_duration=4.719326ms
ts=2022-11-27T18:14:06.515Z caller=main.go:1014 level=info fs_type=XFS_SUPER_MAGIC
ts=2022-11-27T18:14:06.515Z caller=main.go:1017 level=info msg="TSDB started"
ts=2022-11-27T18:14:06.515Z caller=main.go:1197 level=info msg="Loading configuration file" filename=prometheus.yml
ts=2022-11-27T18:14:06.519Z caller=main.go:1234 level=info msg="Completed loading of configuration file" filename=prometheus.yml totalDuration=3.68688ms db_storage=2.02µs remote_storage=2.83µs web_handler=189ns query_engine=433ns scrape=3.42652ms scrape_sd=33.153µs notify=16.474µs notify_sd=4.906µs rules=2.199µs tracing=10.114µs
ts=2022-11-27T18:14:06.519Z caller=main.go:978 level=info msg="Server is ready to receive web requests."
ts=2022-11-27T18:14:06.519Z caller=manager.go:944 level=info component="rule manager" msg="Starting rule manager..."

再重启以下grafana

[root@centos7 prometheus-2.40.3.linux-amd64]# systemctl restart grafana-server

grafana配置prometheus

选择prometheus数据源,以及配置好grafana服务地址

 

 

导入一个模板:11074

 数据源prometheus

 Grafana监控平台结果

top:java进程的%CPU高,us用户态比sy系统态要高,所有java的us用户态导致,系统负载升高

Arthas-Alibaba 开源的 Java 诊断、性能分析工具

 Arthas-安装

下载arthas-boot.jar,然后用java -jar的方式启动:

arthas-boot.jar下载到指定文件夹中,并启动java -jar arthas-boot.jar,执行后会显示目前系统中的java项目有哪些,并以数字开头排序好,我们只需要输入对应项目的编号就可以了

curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar

 启动完成后,自动进入arthas监控工具,输入help回车,查看帮助文档

arthas-thread、heapdump

heapdump,Heap dump(堆)

thread --help,具体查看使用方法

thread,线程,Display thread info, thread stack(栈

 线程,程序里面真正干活的

线程栈,每个干活的线程具体的工作是什么

thread 显示所有线程

 thread -n 5,,显示占用多资源的前5个线程和线程栈信息,发现有问题,UserController.java

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/46763.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

PyCharm+PyQT5之三界面与逻辑的分离

之二的例程已经实现了界面与逻辑的分离,所建立的 Dialog Mainwindow 或者 widgets 等,界面改变其主调程序(暂且这样叫)更改,或者不需要大规模更改, 主调函数的程序是这样的 import sys import FistUI from PyQt5.QtWidgets import QApplication, QMainWindow,QDialog if __nam…

KubeSphere 多行日志采集方案深度探索

作者&#xff1a;大飞哥&#xff0c;视源电子运维工程师&#xff0c;KubeSphere 用户委员会广州站站长 采集落盘日志 日志采集&#xff0c;通常使用 EFK 架构&#xff0c;即 ElasticSearch,Filebeat,Kibana&#xff0c;这是在主机日志采集上非常成熟的方案&#xff0c;但在容器…

React Server Component: 混合式渲染

作者&#xff1a;谢奇璇 React 官方对 Server Comopnent 是这样介绍的: zero-bundle-size React Server Components。 这是一种实验性探索&#xff0c;但相信该探索是个未来 React 发展的方向&#xff0c;与 React Server Component 相关的周边生态正在积极的建设当中。 术语…

R语言主成分分析可视化(颜值高,很详细)

文章目录PCA特征值可视化提取变量结果变量结果可视化变量和主成分的cos2可视化变量对主成分的贡献可视化Dimension description提取样本结果样本结果可视化样本的cos2可视化样本对主成分的贡献可视化biplot参考资料网络上很多R语言教程都是基于R语言实战进行修改&#xff0c;今…

Mysql密码忘记后怎么重置密码,mysql8之后有改动

mysql8之前的修改方式&#xff1a; 1.管理员身份打开cmd&#xff1a;然后关闭mysql&#xff0c;停止MySQL服务&#xff0c;输入 net stop mysql 停止服务 2.切换到MySQL的bin文件下&#xff0c;输入mysqld --console --skip-grant-tables --shared-memory。 3上个窗口保留不要…

四种类型自编码器AutoEncoder理解及代码实现

自编码器&#xff08;AE&#xff09; 自编码器的结构和思想 结构 自编码器是一种无监督的数据压缩和数据特征表达方法。自编码器是神经网络的一种&#xff0c;经过训练后的能尝试将输入复制到输出。自编码器由编码器和解码器组成。如下图所示&#xff1a; 自编码器指的是试图…

电脑键盘功能基础知识,快速入门,抓住这份详细教程

在互联网生活发达的今天&#xff0c;电脑已经成为了学习工作的必备工具。而用来操作电脑的关键&#xff0c;就是我们经常使用的键盘和鼠标。最近有不少的小伙伴来私信小编&#xff0c;希望小编做一个电脑键盘功能基础知识介绍的详细教程。这不&#xff0c;小编应大家要求&#…

视频编解码 - RTP 与 RTCP

目录 RTP 实时传输协议 RTCP协议 将H264 RTP打包 RTP 实时传输协议 音视频数据传输&#xff0c;先将原始数据经过编码压缩后&#xff0c;将码流打包成一个个RTP包&#xff0c;再将码流传输到接收端。 打包的作用 接收端要正确地使用这些音视频编码数据&#xff0c;不仅仅需…

深度学习之路=====12=====>>MNasNet(tensorflow2)

简介 原文&#xff1a; MnasNet: Platform-Aware Neural Architecture Search for Mobile 来源: CVPR2019 作者&#xff1a; Google (Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, Mark Sandler, Andrew Howard, Quoc V. Le) 摘要: 使用神经结构搜索(neural archit…

界面控件DevExpress WPF的主题设计器,可轻松完成应用主题研发

DevExpress WPF拥有120个控件和库&#xff0c;将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpress WPF能创建有着强大互动功能的XAML基础应用程序&#xff0c;这些应用程序专注于当代客户的需求和构建未来新一代支持触摸的解决方案。 DevExpress WPF的The…

一文详解|高校到底如何开展数据分类分级?

数据安全是高校的生命线&#xff0c;在数据安全合规要求不断升级的大背景下&#xff0c;加强数据有效保护&#xff0c;确保数据安全共享应用&#xff0c;已成为高校信息化建设的前线。 安全高楼平地起&#xff0c;作为数据安全建设的基础工作&#xff0c;通过数据分类分级&…

1541_AURIX_TriCore内核架构_内核调试控制器CDC

全部学习汇总&#xff1a; GitHub - GreyZhang/g_tricore_architecture: some learning note about tricore architecture. 这一份笔记可能会是我近段时间来最后的一份内核学习笔记了。我看了下内核手册分为上下两部分&#xff0c;而下卷主要的内容其实是讲解指令集&#xff0c…

如何用CSS画一个三角形?

hello&#xff0c;大家好&#xff0c;最近在看前端的八股&#xff0c;里面有这样一道题&#xff0c;如何用CSS画出三角形&#xff1f;我想以这个题为例&#xff0c;仔细讲一下这个题的技巧&#xff0c;以及对这道题拓展一下&#xff0c;即如何画出圆形和椭圆形&#xff1f; 首…

GFS分布式

GFS是什么&#xff1f; 1.1 简单介绍 这个问题说大也大&#xff0c;说小也小。GFS是Google File System的缩写&#xff0c;字面意义上就是Google的文件系统&#xff0c;技术层面上来讲&#xff0c;GFS是Google在2003年前后创建的可扩展分布式文件系统 &#xff0c;用来满足 Goo…

SpringBoot 接收客户端提交数据/参数会使用到相关注解

目录 一.基本介绍 二.接收参数相关注解应用实例 1.需求: 2.应用实例演示 2.1演示PathVariable 使用 2.2.演示RequestHeader 使用 2.3演示RequestParam 使用 2.4演示CookieValue 使用 2.5演示RequestBody 使用 2.6演示RequestAttribute&#xff0c;SessionAttribute 使…

C语言基础知识

目录 第一章 C语言概述 第二章 数据类型 运算符 表达式 第三章 简单的C程序设计 第四章 选择循环结构 第五章 数组 ​第六章 函数 第七章 编译预处理 第八章 指针 第九章 结构体与共用体 第一章 C语言概述 C语言的特点&#xff1a; 语言简洁、紧凑&#xff1b;使用…

安卓实训作孽之Linux命令手册

文章目录前言演示效果项目地址实现UI进度条实现读取文件获取路径进度条刷新总结前言 开局之前先吐槽一句&#xff0c;NC学校&#xff0c;以及NC老师&#xff0c;还要搞两个作品&#xff0c;上午上课下午实训真牛皮&#xff08;XS&#xff09;。好了废话不多说我们开始吧&#…

进阶自动化测试,你一定要知道的...

自动化测试指软件测试的自动化&#xff0c;在预设状态下运行应用程序或系统&#xff0c;预设条件包括正常和异常&#xff0c;最后评估运行结果。将人为驱动的测试行为转化为机器执行的过程。 自动化测试框架一般可以分为两个层次&#xff0c;上层是管理整个自动化测试的开发&a…

[Spring]第二篇:IOC控制反转

简单的说就是,创建对象的权利,或者是控制的位置,由JAVA代码转移到spring容器,由spring的容器控制对象的创建,就是控制反转. spring创建对象时,会读取配置文件,配置文件中主要配置接口和实现类的关系,每个接口对相应一个实现类,使用<bean>标签配置,<bean中的id可以随便…

微软S2C2F框架已被OpenSSF开源安全体系采用

近日&#xff0c;微软发布“安全供应链消费框架(Secure Supply Chain Consumption Framework&#xff0c;简称S2C2F)”1.1版本。该框架已被OpenSSF供应链完整性工作组采用。至此&#xff0c;OpenSSF开源软件评价相关的项目和指南已覆盖使用安全、关键性、基础设施安全、漏洞披露…