线上问题——频繁 Full GC 问题的排查思路

记一次频繁fullgc排查到解决全流程复盘 阿里云oss文件上传导致的频繁fullgc问题排查到解决全流程复盘 阅读详情
AI摘要

本文围绕线上频繁 Full GC 问题展开,介绍了排查思路。先查看 GC 日志分析频率和原因,再用工具分析内存泄漏,检查对象生命周期,优化代码,调整垃圾回收策略,最后使用监控工具实时监控和分析数据,以解决 Full GC 频繁问题。

一、查看 GC 日志

  1. 启用 GC 日志

    • 在 Java 应用中,需要在启动参数中添加适当的参数来启用 GC 日志记录。可以使用-XX:+PrintGCDetails、-XX:+PrintGCDateStamps、-Xloggc:<log - path>参数。其中 -XX:+PrintGCDetails 会打印详细的 GC 信息,-XX:+PrintGCDateStamps会打印 GC 发生的时间戳,-Xloggc:<log - path>指定了 GC 日志的输出路径。
  2. 分析 GC 日志内容

    • Full GC 频率:查看 GC 日志中 Full GC 发生的频率。如果 Full GC 过于频繁(例如,每分钟多次),则需要深入分析。
    • Full GC 原因:
      • 内存不足(Heap Space):如果日志中显示java.lang.OutOfMemoryError: Java heap space,说明应用程序创建的对象太多,导致堆内存不够用,从而触发 Full GC。
      • 永久代 / 元空间(Permanent Generation / Metaspace)溢出:在旧版本的 Java 中,可能会出现java.lang.OutOfMemoryError: PermGen space,在 Java 8 及以后可能会出现java.lang.OutOfMemoryError: Metaspace。这表示类加载过多或者存在类加载器泄漏等问题,导致永久代或元空间被耗尽。
      • System.gc () 调用:如果在日志中发现有Full GC(System),说明应用程序中显式调用了System.gc()方法。虽然在现代 JVM 中,System.gc()的调用不一定会立即触发 Full GC,但如果频繁调用,可能会导致 Full GC 频繁发生。
Full GC 排查的方式有哪些? Full GC(Full Garbage Collection) 是 Java 虚拟机(JVM)中的一种垃圾回收机制,它会清理整个堆内存(包括新生代和老年代),通常会导致应用程序暂停(Stop-The-World)。Full GC 的频繁发生会严重影响系统性能,因此需要及时排查和优化。以下是排查 Full GC 的常见方式:使用监控工具可以实时观察 JVM 的内存使用情况和 GC 行为。jstat: 关键指标: :Full GC 次数。 :Full GC 总耗时。 :GC 总耗时。 jmap: 阅读详情

相关推荐

线上服务器一小时一次fullGc排查

现状: -Xms:8G -Xmx:8G -Xmn:2G 下面是gc日志输出的配置: CommandLine flags: -XX:CMSInitiatingOccupancyFraction=75 -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/logs/Heap...

不良IP的博客 844

纯干货:线上出现fullGC次数很多的排查思路以及实践总结

最近线上发布了一个版本,导致full gc次数忽然就上去了,虽然对线上业务造成的影响还不是很大,但是为了以防万一还是对这个问题做了相关排查。 GC命令排查 一开始还是从堆的变化开始: # 查看每秒的堆发生的变化以及gc的次数 jstat -gcutil pid 1000 相关参数: s0 : Heap上的 Survivor space 0 区已使用空间的百分比 s1 : Heap上的 S...

长沙要起风了、 7386

GNSS数据处理(一)——开源软件RTKLIB与G-Nut/Anubis实战入门

本文详细介绍了GNSS数据处理的开源软件RTKLIB与G-Nut/Anubis的实战入门指南。从软件安装、数据获取到静态短基线解算,逐步讲解操作技巧与常见问题排查,帮助测绘与地质监测人员快速掌握GNSS数据处理技术,提升工作效率。

weixin_30733003的博客 136

Vivado IP核综合失败别慌:除了打补丁,这个TCL命令也能救急(以Video Frame Buffer为例)

本文详细解析了Vivado IP核综合失败的排查方法,特别是针对Video Frame Buffer Read IP的常见问题。从补丁安装到深入分析DCP文件生成机制,再到使用强大的TCL命令`foreach ip_in_proj [get_ips] {compile_c [get_ips $ip_in_proj]}`强制重编译,提供了一套完整的解决方案。帮助开发者快速定位并解决IP核综合失败问题,确保项目顺利进行。

weixin_30892889的博客 424

NSIDC海冰运动产品-速度矢量场图绘制(数据下载和处理--年、季节平均)【python/basemap】

入门级NSIDC海冰运动产品速度矢量场图绘制(数据下载和处理--年、季节平均)【python/basemap】

Mluoo的博客 2959

python:numpy分享(保姆级教程)

创建数组:array和ndarray、rand()、randn()、arange()、randint()、uniform()astype()基础函数:ceil()、floor()、rint()、argmax()、argmin()、cumsum()、cumprod()numpy 是数据分析必不可少的第三方库,具有高性能的特点,多用于做数组分析。内置函数:ceil()、floor()、rint()主要用于数组计算,支持多维数组。array和ndarray。比较函数:all、any。去重函数:unique。

sulin123123的博客 1730

Dataset - DeepFashion 服装数据集

Dataset - DeepFashion 服装数据集 [Dataset - DeepFashion] [Project - DeepFashion] 1. 服装类别和属性预测集 [Category - Attribute 下载] [百度网盘] 289,222 张服装图片 clothes images; 50 个服装类别 clothing categories 1,000 ...

长风破浪会有时,直挂云帆济沧海 2万+

【Qualcomm高通音频】音效调试_录音文件播放有杂音,如何定位原因?

一、录音播放数据处理过程介绍 (1)TX方向 麦克风(硅麦克风或者主机体麦克风)采集模拟音频信号,经过内部CODEC芯片中的adc转换为数字信号,在经过高通音频DSP处理音效后编码为wav/aac/amr/mp3等格式文件。 (2)RX方向 音频文件经过解码、重采样还原为pcm数据,经过DSP处理音效后送到内部CODEC,然后经过DAC转换为模拟信号,送到喇叭。 二、分析步骤 1...

crow_ch的博客 5972

uniapp - 微信小程序接入官方人脸识别认证详细流程及示例源码,Uniapp微信小程序项目集成官方提供的人脸识别身份验证插件接口(多种示例:人脸核验、身份证件与人脸是否匹配、是否活体、实名认证等)

uni-app微信小程序人脸识别认证,使用uniapp开发微信小程序的人脸采集功能/人脸识别功能,uniapp vue3微信小程序活体人脸识别,Uni-app微信小程序实名认证,uniApp微信小程序人脸认证,UniApp的微信小程序实名认证与人脸识别系统开发,人脸核身微信小程序uni-app接入流程,wx.startFacialRecognitionVerify,uniapp开发微信小程序-人脸采集功能、微信人脸识别实名认证集成指南,识别失败,人脸识别接口怎么调用,前后端完整示例代码demo,人脸检测功能

🏆 前端领域优质创作者 3284

springboot&mybatis中数组和字符串数据类型的转换

/前端数组字段//数据库中字段/*与前端交互时使用的get/set*/System.out.println("接收前端数据");/*与前端交互时使用的get/set*//*与数据库交互时使用的get/set*/System.out.println("从数据库中读取数据");/*与数据库交互时使用的get/set*/

l_q_l的专栏 2475

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

上一篇: MySQL——MySQL 日志
下一篇: 算法——排序算法(冒泡、选择、归并、堆排序)
ShareBeHappy_Qin
博客等级 码龄9年 2321粉丝 137原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值