聊聊jvm的direct buffer统计
序
本文主要研究一下jvm的direct buffer统计
spring boot metrics
jvm.memory.used
{"name": "jvm.memory.used","description": "The amount of used memory","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 137868592}],"availableTags": [{"tag": "area","values": ["heap","nonheap"]},{"tag": "id","values": ["Compressed Class Space","PS Survivor Space","PS Old Gen","Metaspace","PS Eden Space","Code Cache"]}]
}
jvm.memory.used包括heap和nonheap两大类
heap
http://localhost:8080/actuator/metrics/jvm.memory.used?tag=area:heap
{"name": "jvm.memory.used","description": "The amount of used memory","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 84724536}],"availableTags": [{"tag": "id","values": ["PS Eden Space","PS Survivor Space","PS Old Gen"]}]
}
heap的话根据具体的垃圾收集器类型有不同的区分
nonheap
http://localhost:8080/actuator/metrics/jvm.memory.used?tag=area:nonheap
{"name": "jvm.memory.used","description": "The amount of used memory","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 54874872}],"availableTags": [{"tag": "id","values": ["Metaspace","Compressed Class Space","Code Cache"]}]
}
nonheap这里包括3个,分别是Metaspace、Compressed Class Space、Code Cache
jvm.buffer.memory.used
http://localhost:8080/actuator/metrics/jvm.buffer.memory.used?tag=id:direct
{"name": "jvm.buffer.memory.used","description": "An estimate of the memory that the Java virtual machine is using for this buffer pool","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 81920}],"availableTags": [{"tag": "id","values": ["direct","mapped"]}]
}
jvm.buffer.memory.used包含了direct、mapped两大类
direct
http://localhost:8080/actuator/metrics/jvm.buffer.memory.used?tag=id:direct
{"name": "jvm.buffer.memory.used","description": "An estimate of the memory that the Java virtual machine is using for this buffer pool","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 81920}],"availableTags": []
}
mapped
http://localhost:8080/actuator/metrics/jvm.buffer.memory.used?tag=id:mapped
{"name": "jvm.buffer.memory.used","description": "An estimate of the memory that the Java virtual machine is using for this buffer pool","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 0}],"availableTags": []
}
jvm.buffer.count
http://localhost:8080/actuator/metrics/jvm.buffer.count
{"name": "jvm.buffer.count","description": "An estimate of the number of buffers in the pool","baseUnit": "buffers","measurements": [{"statistic": "VALUE","value": 10}],"availableTags": [{"tag": "id","values": ["direct","mapped"]}]
}
jvm.buffer.count分direct和mapped两大类
direct
http://localhost:8080/actuator/metrics/jvm.buffer.count?tag=id:direct
{"name": "jvm.buffer.count","description": "An estimate of the number of buffers in the pool","baseUnit": "buffers","measurements": [{"statistic": "VALUE","value": 10}],"availableTags": []
}
mapped
http://localhost:8080/actuator/metrics/jvm.buffer.count?tag=id:mapped
{"name": "jvm.buffer.count","description": "An estimate of the number of buffers in the pool","baseUnit": "buffers","measurements": [{"statistic": "VALUE","value": 0}],"availableTags": []
}
jvm.buffer.total.capacity
http://localhost:8080/actuator/metrics/jvm.buffer.total.capacity
{"name": "jvm.buffer.total.capacity","description": "An estimate of the total capacity of the buffers in this pool","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 81920}],"availableTags": [{"tag": "id","values": ["direct","mapped"]}]
}
jvm.buffer.total.capacity分direct和mapped两大类
direct
http://localhost:8080/actuator/metrics/jvm.buffer.total.capacity?tag=id:direct
{"name": "jvm.buffer.total.capacity","description": "An estimate of the total capacity of the buffers in this pool","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 81920}],"availableTags": []
}
mapped
http://localhost:8080/actuator/metrics/jvm.buffer.total.capacity?tag=id:mapped
{"name": "jvm.buffer.total.capacity","description": "An estimate of the total capacity of the buffers in this pool","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 0}],"availableTags": []
}
Native Memory Tracking
summary
jcmd 6878 VM.native_memory summary scale=MB
6878:Native Memory Tracking:Total: reserved=5625MB, committed=844MB
- Java Heap (reserved=4096MB, committed=577MB)(mmap: reserved=4096MB, committed=577MB)- Class (reserved=1066MB, committed=46MB)(classes #7027)(malloc=10MB #10535)(mmap: reserved=1056MB, committed=37MB)- Thread (reserved=36MB, committed=36MB)(thread #37)(stack: reserved=36MB, committed=36MB)- Code (reserved=246MB, committed=15MB)(malloc=2MB #3834)(mmap: reserved=244MB, committed=12MB)- GC (reserved=160MB, committed=148MB)(malloc=10MB #220)(mmap: reserved=150MB, committed=138MB)- Internal (reserved=10MB, committed=10MB)(malloc=10MB #10055)- Symbol (reserved=9MB, committed=9MB)(malloc=8MB #74319)(arena=2MB #1)- Native Memory Tracking (reserved=2MB, committed=2MB)(tracking overhead=2MB)
其中Internal部分包含了jvm中使用的directBuffer的大小
示例
public void run(String... args) throws Exception {// 分配一个256MB的直接缓冲区ByteBuffer buffer = ByteBuffer.allocateDirect(256 * 1024 * 1024);// 填充数据Random random = new Random();while (buffer.remaining() >= 4) {buffer.putInt(random.nextInt());}System.out.println("Allocated direct buffer with capacity " + buffer.capacity());}
VM.native_memory
jcmd 8077 VM.native_memory summary scale=MB
8077:Native Memory Tracking:Total: reserved=5881MB, committed=1099MB
- Java Heap (reserved=4096MB, committed=576MB)(mmap: reserved=4096MB, committed=576MB)- Class (reserved=1066MB, committed=46MB)(classes #7028)(malloc=10MB #10794)(mmap: reserved=1056MB, committed=37MB)- Thread (reserved=36MB, committed=36MB)(thread #37)(stack: reserved=36MB, committed=36MB)- Code (reserved=246MB, committed=16MB)(malloc=2MB #3889)(mmap: reserved=244MB, committed=13MB)- GC (reserved=160MB, committed=148MB)(malloc=10MB #220)(mmap: reserved=150MB, committed=138MB)- Internal (reserved=266MB, committed=266MB)(malloc=266MB #10055)- Symbol (reserved=9MB, committed=9MB)(malloc=8MB #74324)(arena=2MB #1)- Native Memory Tracking (reserved=2MB, committed=2MB)(tracking overhead=2MB)
可以看到Internal部分由之前的10MB增大到了266MB
jvm.buffer.memory.used
http://localhost:8080/actuator/metrics/jvm.buffer.memory.used?tag=id:direct
{"name": "jvm.buffer.memory.used","description": "An estimate of the memory that the Java virtual machine is using for this buffer pool","baseUnit": "bytes","measurements": [{"statistic": "VALUE","value": 268476416}],"availableTags": []
}
可以看到jvm.buffer.memory.used的direct部分也变大了
小结
jvm的direct buffer可以通过springboot的jvm.buffer.memory.used?tag=id:direct来统计,也可以通过MNT的Internal部分反应出来。
doc
- 聊聊HotSpot VM的Native Memory Tracking
- 聊聊jvm的-XX:MaxDirectMemorySize
- 聊聊openjdk的BufferPoolMXBean
- 聊聊jvm的Code Cache
- 聊聊jvm的CompressedClassSpace
- 聊聊jvm的Stack Memory
- 聊聊jvm的StringTable及SymbolTable
相关文章:
聊聊jvm的direct buffer统计
序 本文主要研究一下jvm的direct buffer统计 spring boot metrics jvm.memory.used {"name": "jvm.memory.used","description": "The amount of used memory","baseUnit": "bytes","measurements"…...

C/C++ 位段
目录 什么是位段? 位段的内存分配 位段的跨平台问题 什么是位段? 位段的声明与结构是类似的,但是有两个不同: 位段的成员必须是 int、unsigned int 或signed int 等整型家族。位段的成员名后边有一个冒号和一个数字 这是一个…...
Peter算法小课堂—树的应用
开篇先给大家讲个东西,叫vector,有老师称之为“向量”,当然与数学中的向量不一样啊,所以我要称之为“长度可变的数组” vector 头文件:#include <vector> 用法:vector<int> d; 尾部增加元素…...

FineBI:简介
1 介绍 FineBI 是帆软软件有限公司推出的一款商业智能(Business Intelligence)产品。 FineBI 是定位于自助大数据分析的 BI 工具,能够帮助企业的业务人员和数据分析师,开展以问题导向的探索式分析。 2 现阶段数据分析弊端 现阶…...
原神单机版【完全无脑搭建】⭐纯单机⭐*稳定版*
版本介绍 版本3.7稳定版【过分追新并不稳,合理才完美】 独家原神,游戏内自带剧情任务,完美仿官,一比一完美复制! 已经拥有完美剧情、任务、副本、卡池、深渊、全物品、和全部功能和皮肤。 送:GM全套工具…...

用通俗易懂的方式讲解:万字长文带你入门大模型
告别2023,迎接2024。大模型技术已成为业界关注焦点,你是否也渴望掌握这一领域却又不知从何学起? 本篇文章将特别针对入门新手,以浅显易懂的方式梳理大模型的发展历程、核心网络结构以及数据微调等关键技术。 如果你在阅读中收获…...
Invalid options in vue.config.js: “plugins“ is not allowed
项目场景: 安装并配置elementPlus报错。 问题描述 "plugins" is not allowed. plugins不被允许。参考官网修改配置文件vue.config.js。 解决方案: const AutoImport require(unplugin-auto-import/webpack) const Components require(un…...
四、C语言中的数组:数组的创建与初始化
其实在之前的学习中我们已经或多或少接触到了数组,有关scanf()的安全用法中我们提到了如何避免数组溢出的问题,详情可以查看二、C语言数据类型与变量(scanf和printf (4)完) 这一章我们将详细学习数组在C语言中的应用 1.数组的概…...

html5中各标签的语法格式总结以及属性值说明
有关闭标签的元素 a元素 <a href"" target"" title""></a>表格相关元素 table元素:表格标签caption元素:表头thead元素tbody元素:表格主体元素tfoot元素th元素tr元素:行标签td元素&…...
力扣(leetcode)第412题Fizz Buzz(Python)
412.Fizz Buzz 题目链接:412.Fizz Buzz 给你一个整数 n ,找出从 1 到 n 各个整数的 Fizz Buzz 表示,并用字符串数组 answer(下标从 1 开始)返回结果,其中: answer[i] “FizzBuzz” 如果 i 同…...

苦学golang半年,写了一款web服务器
苦学golang半年,写了一款web服务器 文章目录 苦学golang半年,写了一款web服务器example 项目地址:https://github.com/fengyuan-liang/jet-web-fasthttp 可以的话,请star支持一下🙂 苦学golang半年,写了一款…...

uniapp vue2 车牌号输入组件记录
uniapp vue2 车牌号输入案例记录 组件如图 直接上代码 1.html <template><view><view class"plate" :class"{show: show}"><view class"itemFirst flex-d"><view class"item item1" click"handl…...

Unity 点击对话系统(含Demo)
点击对话系统 可实现点击物体后自动移动到物体附近,然后弹出对话框进行对话。 基于Unity 简单角色对话UI脚本的编写(新版UI组件)和Unity 关于点击不同物品移动并触发不同事件的结合体,有兴趣可以看一下之前文章。 下边代码为U…...
vue接入高德地图
使用 JSAPI 安全模式,代理服务请以_AMapService 作为一级路由 index.html <script type"text/javascript">window._AMapSecurityConfig {serviceHost: "http://xx.xx.xx.xx:8223/_AMapService"};</script><script type"text/javascr…...

Linux的基本指令(5)
目录 bc指令 uname指令 压缩解压相关的指令 zip指令 unzip指令 tar打包压缩指令 tar解压解包指令 传输指令sz&rz 热键 关机命令 安装:yum install -y 指令 bc指令 bc命令可以很方便的进行浮点运算 Linux中的计算器 uname指令 语法:unam…...

华为商城秒杀时加密验证 device_data 的算法研究
前言 之前华为商城放出 Mate60 手机时, 想给自己和家人抢购一两台,手动刷了好几天无果后,决定尝试编写程序,直接发送 POST 请求来抢。通过抓包和简单重放发送后,始终不成功。仔细研究,发现 Cookie 中有一个名为 devic…...

Wrk压测发送Post请求的正确姿势
一、Wrk简介 wrk 是一个能够在单个多核 CPU 上产生显著负载的现代 HTTP 基准测试工具。它采用了多线程设计,并使用了像 epoll 和 kqueue 这样的可扩展事件通知机制。此外,用户可以指定 LuaJIT 脚本来完成 HTTP 请求生成、响应处理和自定义报告等功能。 …...
【管理篇 / 登录】❀ 06. macOS下使用USB配置线登录 ❀ FortiGate 防火墙
【简介】飞塔防火墙上都会配有CONSOLE接口,包装里都会配置一根USB配置线,通过这个接口和这根线,我们可以用命令的方式登录飞塔防火墙。随着苹果电脑的普及,我们来学习如何在macOS中使用USB配置线登录飞塔防火墙。 早期飞塔防火墙包…...
linux系统shell语言的自动化交互
自动化交互 自动化交互expect交互expect用法 sshpass概念shhpass的脚本批量拷贝文件批量传递秘钥批量修改密码 自动化交互 expect交互 yum -y install expect tcl tcl-devel //安装expect交互工具expect用法 用法: 1)#!/usr/bin/expect //定义脚本执行的shell 2)set …...
HarmonyOS ArkTS 三方库的基本使用(十六)
如何获取三方库 目前提供了两种途径获取开源三方库: 1、通过访问Gitee网站开源社区获取 在Gitee中,搜索OpenHarmony-TPC仓库,在tpc_resource中对三方库进行了资源汇总,可以供开发者参考。 2、通过OpenHarmony三方库中心仓获取 …...
Vue记事本应用实现教程
文章目录 1. 项目介绍2. 开发环境准备3. 设计应用界面4. 创建Vue实例和数据模型5. 实现记事本功能5.1 添加新记事项5.2 删除记事项5.3 清空所有记事 6. 添加样式7. 功能扩展:显示创建时间8. 功能扩展:记事项搜索9. 完整代码10. Vue知识点解析10.1 数据绑…...

NLP学习路线图(二十三):长短期记忆网络(LSTM)
在自然语言处理(NLP)领域,我们时刻面临着处理序列数据的核心挑战。无论是理解句子的结构、分析文本的情感,还是实现语言的翻译,都需要模型能够捕捉词语之间依时序产生的复杂依赖关系。传统的神经网络结构在处理这种序列依赖时显得力不从心,而循环神经网络(RNN) 曾被视为…...

3-11单元格区域边界定位(End属性)学习笔记
返回一个Range 对象,只读。该对象代表包含源区域的区域上端下端左端右端的最后一个单元格。等同于按键 End 向上键(End(xlUp))、End向下键(End(xlDown))、End向左键(End(xlToLeft)End向右键(End(xlToRight)) 注意:它移动的位置必须是相连的有内容的单元格…...
力扣-35.搜索插入位置
题目描述 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 请必须使用时间复杂度为 O(log n) 的算法。 class Solution {public int searchInsert(int[] nums, …...
docker 部署发现spring.profiles.active 问题
报错: org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property spring.profiles.active imported from location class path resource [application-test.yml] is invalid in a profile specific resource [origin: class path re…...

技术栈RabbitMq的介绍和使用
目录 1. 什么是消息队列?2. 消息队列的优点3. RabbitMQ 消息队列概述4. RabbitMQ 安装5. Exchange 四种类型5.1 direct 精准匹配5.2 fanout 广播5.3 topic 正则匹配 6. RabbitMQ 队列模式6.1 简单队列模式6.2 工作队列模式6.3 发布/订阅模式6.4 路由模式6.5 主题模式…...

day36-多路IO复用
一、基本概念 (服务器多客户端模型) 定义:单线程或单进程同时监测若干个文件描述符是否可以执行IO操作的能力 作用:应用程序通常需要处理来自多条事件流中的事件,比如我现在用的电脑,需要同时处理键盘鼠标…...

淘宝扭蛋机小程序系统开发:打造互动性强的购物平台
淘宝扭蛋机小程序系统的开发,旨在打造一个互动性强的购物平台,让用户在购物的同时,能够享受到更多的乐趣和惊喜。 淘宝扭蛋机小程序系统拥有丰富的互动功能。用户可以通过虚拟摇杆操作扭蛋机,实现旋转、抽拉等动作,增…...

elementUI点击浏览table所选行数据查看文档
项目场景: table按照要求特定的数据变成按钮可以点击 解决方案: <el-table-columnprop"mlname"label"名称"align"center"width"180"><template slot-scope"scope"><el-buttonv-if&qu…...
Vue 3 + WebSocket 实战:公司通知实时推送功能详解
📢 Vue 3 WebSocket 实战:公司通知实时推送功能详解 📌 收藏 点赞 关注,项目中要用到推送功能时就不怕找不到了! 实时通知是企业系统中常见的功能,比如:管理员发布通知后,所有用户…...