什么会导致 java 进程大大超过 Xmx 或 Xss 限制? [英] What would cause a java process to greatly exceed the Xmx or Xss limit?

查看:28
本文介绍了什么会导致 java 进程大大超过 Xmx 或 Xss 限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 7 个不同的 Java 守护程序,我在 3 个不同的服务器上运行(全部 7 个).java命令行有-Xmx2048m和-Xss1024k.在这 3 台服务器上,所有 21 个进程的顶部和顶部的 VIRT 大小均显示为略低于 2.5 GB.RES 大小从 300 GB 到 1.9 GB 不等,具体取决于它是哪个守护进程.

I have 7 different java daemons that I run (all 7) on 3 different servers. The java command line has -Xmx2048m and -Xss1024k. On these 3 servers, all 21 processes show just under 2.5 GB for VIRT size in top and atop. RES size varies from 300 to 1.9 GB according to which daemon it is.

一切都应该如此.

输入新服务器.更快的 CPU,更多的 RAM(16 GB 而不是 8 GB),稍微更新的 java(旧服务器上的 1.6.0_10-b33,新服务器上的 1.6.0_31-b04).两个系统(和 JVM)都是 64 位的.

Enter the new server. Faster CPU, more RAM (16 GB instead of 8 GB), slightly newer java (1.6.0_10-b33 on the old servers, 1.6.0_31-b04 on the new server). Both systems (and JVMs) are 64bit.

将 2 个守护进程移至新服务器.在新服务器上,给定相同的任务,守护进程既消耗大量 CPU(大约相当于一个内核的价值),又完成得更少.(从旧系统上的 5110 处理器移至新系统上的 5620).

Moved 2 of the daemons to the new server. On the new server, given the same task, the daemons are both consuming vastly more CPU (about a core's worth) and getting Less done. (Moved from 5110 processors on the old systems to 5620s on the new one).

几乎是一个完整的额外核心 CPU 使用率(GC 线程??),一个守护进程报告 5 GB VIRT 和 2 GB RES,另一个守护进程报告 10.5 GB VIRT 和 2 GB RES.

Pretty much a full extra core of CPU usage (GC thread??) and reporting 5 GB VIRT and 2 GB RES for one daemon and 10.5 GB VIRT and 2 GB RES for the other daemon.

有什么想法会导致 java 忽略(或者如果是这种情况,似乎会忽略)内存限制?

Any ideas what would cause java to ignore (or appear to ignore if that is the case) the memory limits?

推荐答案

原来这是一个 glibc 问题.

Turns out this is a glibc problem.

我的简短回答是:

导出 MALLOC_ARENA_MAX=1

export MALLOC_ARENA_MAX=1

这将流程占用空间(顶部的 VIRT)减少了多达 5 倍.回到 CentOS 5 中看到的级别.

This decreased process footprint (VIRT in top) by as much as 5x. Back to the levels seen in CentOS 5.

最新版本的 glibc 有一个新特性每线程内存池":

Recent versions of glibc have a new feature "per-thread memory pools":

http://www.centos.org/docs/5/html/5.4/Technical_Notes/glibc.html

1.71.1 日志部分的最后一项讨论了它(并指的是一个非公开的错误......)

The last item in the 1.71.1 log section discusses it (and refers to a non-public bug....)

这篇关于什么会导致 java 进程大大超过 Xmx 或 Xss 限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆