日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

为Liferay Server分配Perm,Heap Size

發(fā)布時間:2025/3/20 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 为Liferay Server分配Perm,Heap Size 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

?上個月我們公司的Liferay專家請我?guī)退侠矸峙鋚erm和heap size從而能讓liferay服務(wù)器可以達(dá)到最高的性能:我從我的經(jīng)驗出發(fā),給了我認(rèn)為最理想的內(nèi)存劃分。

直接貼上原始郵件內(nèi)容了:

?

?

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

?

轉(zhuǎn)載于:https://blog.51cto.com/supercharles888/980694

總結(jié)

以上是生活随笔為你收集整理的为Liferay Server分配Perm,Heap Size的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。