上个月我们公司的Liferay专家请我帮她合理分配perm和heap size从而能让liferay服务器可以达到最高的性能:我从我的经验出发,给了我认为最理想的内存划分。

直接贴上原始邮件内容了:

Factors into consideration:

(1)    Is the server only run Liferay? Or besides it ,it also need to run other services.

Perm Space:

(2)    The perm size will not be set too large ,because no GC will clear perm space.

(3)    The perm size will not be set too small ,because if classloader load a lot of classes(For example ,a lot of entry in classpath) ,it will “Perm Gem space overflow” error.

Heap Space( GC<Gabbage Collection> will work on Heap space):

(4)    Heap Size should not be set to too small, if too small ,a lot of GC will happen ,which reduce the server performance.

(5)    The - xms should not  be set too large ,otherwise , the GC thread will update the heap’s  Young to Old frequently.

(6)    It’s better that –xms  is equal to –xmx (High Concurrent Application), otherwise ,-xms should be 1/2 to 1/3 of the -xmx, and –xmn is 1/3 of the -xmx

Stack:

(7)    If we don’t have a lot of recursion invocation ,this number shouldn’t be set to too large.

GC:

(8)    If Heap Size is too large ,it will cost a lot of time to do GC ,but since it is low –priority process, so it won’t affect too much.

The Result:

If the server’s memory is M ( It should be physical memory (vi /proc/meminfo)  minus the necessary daemon process’s occupation)

If our application is (1) dedicated application (2) less concurrency access (3) don’t need a lot of temp memory (4) web framework ,don’t have sophisticated recursion

My  suggestion:

Heap:

-xmx   2/3M (Large can reduce the frequency of GC, but increase the GC time )

-xms   1/3M( Since we are not the high-concurrence application ,unlike e-commerce website, only a few person use our portal website ,so  set xms to ½ of –xmx is enough)

-xmn  256M(  we should set it as small as possible if we don’t need too many temp memory)

Perm:

-xxPermSize  128M (the minimum of the perm size , 256M is enough for our  liferay server ,because it is not need so many classes to load by classloader)

We can use jmap to collect the perm size that our running process actually occupied (Suppose our liferay running instance is 7317):

[cwang58@cwang58-linux eclipse]$ jmap 7317

Attaching to process ID 7317, please wait...

Debugger attached successfully.

Server compiler detected.

JVM version is 20.4-b02

0x00215000      109K    /lib/ld-2.3.4.so

0x00234000      1511K   /lib/tls/libc-2.3.4.so

0x00366000      209K    /lib/tls/libm-2.3.4.so

0x0038b000      16K     /lib/libdl-2.3.4.so

0x00511000      105K    /lib/tls/libpthread-2.3.4.so

0x00aa5000      79K     /lib/libresolv-2.3.4.so

0x00dc1000      49K     /lib/tls/librt-2.3.4.so

0x0478d000      99K     /lib/libnsl-2.3.4.so

0x08048000      46K     /app/jdk1.6.0_29/bin/java

0x6066f000      22K     /lib/libnss_dns-2.3.4.so

0x60f06000      26K     /app/jdk1.6.0_29/jre/lib/i386/headless/libmawt.so

0x60f0c000      612K    /app/jdk1.6.0_29/jre/lib/i386/libawt.so

0x62fe8000      94K     /app/jdk1.6.0_29/jre/lib/i386/libnet.so

0x63441000      34K     /app/jdk1.6.0_29/jre/lib/i386/libmanagement.so

0x63773000      18K     /app/jdk1.6.0_29/jre/lib/i386/libdt_socket.so

0xb70d0000      75K     /app/jdk1.6.0_29/jre/lib/i386/libzip.so

0xb70e1000      46K     /lib/libnss_files-2.3.4.so

0xb72fd000      12K     /app/jdk1.6.0_29/jre/lib/i386/libnpt.so

0xb7301000      272K    /app/jdk1.6.0_29/jre/lib/i386/libjdwp.so

0xb733e000      184K    /app/jdk1.6.0_29/jre/lib/i386/libjava.so

0xb7363000      55K     /app/jdk1.6.0_29/jre/lib/i386/libverify.so

0xb73c0000      10022K  /app/jdk1.6.0_29/jre/lib/i386/server/libjvm.so

0xb7fe5000      37K     /app/jdk1.6.0_29/jre/lib/i386/jli/libjli.so

Not so much.

-xxMaxPermSize 256M ( the maximum perm size ,in occasion ,it should be double of the minimum perm size )

Stack:

-Xss 256k(because we are web application ,don’t need sophisticate calculation)

One Solution:

If our memory is 4G ( suppose 1G is occupied by OS and daemon processes)

One of the best practice is :

-xmx 2048M

-xms 1024M

-xmn 256M

-xxPermSize 128M

-xxMaxPermSize 256M

-Xss 256k

转载于:https://blog.51cto.com/supercharles888/980694

为Liferay Server分配Perm,Heap Size相关推荐

  1. Heap size 80869K exceeds notification threshold (51200K)

    前阵子的alert日志获得了所需堆尺寸的大小超出指定阙值的提示,即Heap size 80869K exceeds notification threshold (51200K).从Oracle 10 ...

  2. 为什么Java进程使用的RAM比Heap Size大?

    点击蓝色"程序猿DD"关注我 回复"资源"获取独家整理的学习资料! 作者 | 阿杜的世界 来源 | 公众号「javaadu」 Java进程使用的虚拟内存确实比J ...

  3. 为什么 Java 进程使用的 RAM 比 Heap Size 大?​ | CSDN博文精选

    作者 | javaadu 责编 | 郭芮 出品 | CSDN 博客 Java进程使用的虚拟内存确实比Java Heap要大很多.JVM包括很多子系统:垃圾收集器.类加载系统.JIT编译器等等,这些子系 ...

  4. java heap size 乐视_BigData-ZooKeeper-JVM Heap size Setting

    ZooKeeper 官网 搭建ZooKeeper  Cluster 使用ZooKeeper 目的:ZooKeeper 是一个面向分布式系统的构件块.当设计一个分布式系统时,一般需要设计和开发一些协调服 ...

  5. Heap size 441420K exceeds notification threshold (307200K) KGL object name :SYS.ALERT_QUE

    这个问题一直困扰我很久了.今天终于解决了. 之前一直问这问那.老师说的bug,要打补丁...我勒个去哦.我现在这点工资,没必要瞎折腾,出了问题我也担待不起,生产库打补丁.伤不起啊. Heap size ...

  6. java heap size 设置_Java heap size

    今天在性能诊断工作中遇到 Java heap size, 下面是它的相关的概念. 什么是Java heap size ? Java heap size 堆栈大小, 指Java 虚拟机的内存大小.我的理 ...

  7. Not enough memory. Please load a smaller dataset or use larger heap size.

    今天在win7下装weka发现运行不了,后来下载了jdk 1.6 64bit之后,正常安装了 weka 3.7 现在正常运行,但是载入基因表达数据集后运行filter跳出错误警告如下: Error M ...

  8. Broker 的 Heap Size 如何设置?

    如何设置 Heap Size 的问题,其实和 Kafka 关系不大,它是一类非常通用的面试题目.一旦你应对不当,面试方向很有可能被引到 JVM 和 GC 上去,那样的话,你被问住的几率就会增大.因此, ...

  9. Spark问题:System memory 259522560 must be at least 4.718592E8. Please use a larger heap size.

    在本地运行Spark程序时:报出下面的异常: Exception in thread "main" java.lang.IllegalArgumentException: Syst ...

最新文章

  1. 一次内网靶场学习记录
  2. 电气:电能扰动质量数据集模拟生成(matlab)
  3. 新建linux组、用户命令
  4. 牛客 - 树上求和(贪心+树形dp)
  5. 如何向通过TCP socket给服务器端发送的数据里注明自己的客户端地址
  6. html5拖动的面板 panel,基于jQuery UI的Bootstrap Panel面板功能增强插件
  7. 从 DevOps 到 NoOps,Serverless 技术的落地方式探讨
  8. ROS在类中发布和接受消息(标准消息)
  9. Centos 6.6 安装
  10. Oracle中查询树结构start with...connect by prior子句用法
  11. 【数据结构与算法】详解什么是哈希表,并用代码手动实现一个哈希表
  12. 获取小程序页面跳转链接
  13. ckplayer6.8修改logo
  14. linux安装硬盘阵列卡驱动,centos7 RAID磁盘阵列卡驱动安装图文教程
  15. 网秦上市前夕被央视曝光恶意吸费 网秦飞流否认
  16. 学计算机要具备什么能力,具备什么特质能学计算机
  17. CAD在画线的过程中显示长度和角度
  18. 【2019/07/20测试 T2】切题
  19. 美赞臣中国独立后任命朱定平为总裁;思拓凡亚洲首个技术研发卓越中心上海揭幕 | 美通社头条...
  20. 51GIS学院|分享大数据项目架构思考(一)

热门文章

  1. [js高手之路]深入浅出webpack教程系列9-打包图片(file-loader)用法
  2. 【bzoj2154】Crash的数字表格 莫比乌斯反演
  3. Mysql 5.7 报错 3534 错误
  4. 前端不为人知的一面--前端冷知识集锦
  5. C#反编译工具Reflector使用方法
  6. 竞品分析框架及案例-探索业务方向
  7. 如何从0到1搭建电商促销系统?
  8. PMcaff-培训 | 活动报名结束,押金和邮件须知的那些事儿
  9. 腾讯 Web UI 解决方案 QMUI Web —— 探索与沉淀
  10. 模块mod_h323的编译