XX:MaxPermSize=128m for Tomcat 8 / Java 7, why?

Etienne Dysli-Metref etienne.dysli-metref at switch.ch
Fri Nov 20 09:38:15 EST 2015


The wiki page
https://wiki.shibboleth.net/confluence/display/IDP30/ApacheTomcat8
recommends putting -XX:MaxPermSize=128m in CATALINA_OPTS to set the
PermGen space size, but unfortunately without saying why this is
necessary. Does anyone know the explanation?

It turns out this actually makes the PermGen space *smaller* depending
on the amount of RAM your machine has. I've tried with 1, 2 and 8GB and
my JVM would always choose 166MB for PermGen. I don't see any reason to
reduce PermGen, especially with Tomcat having a tendency to quickly fill
it up when redeploying a webapp several times.

For example:

$ java -XX:MaxPermSize=128m -XX:+PrintFlagsFinal -version | grep PermSize
  uintx AdaptivePermSizeWeight   = 20              {product}
  uintx MaxPermSize             := 134217728       {pd product}
  uintx PermSize                 = 21757952        {pd product}
java version "1.7.0_91"
OpenJDK Runtime Environment (rhel-2.6.2.1.el7_1-x86_64 u91-b00)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)

$ java -XX:+PrintFlagsFinal -version | grep PermSize
  uintx AdaptivePermSizeWeight   = 20              {product}
  uintx MaxPermSize              = 174063616       {pd product}
  uintx PermSize                 = 21757952        {pd product}
java version "1.7.0_91"
OpenJDK Runtime Environment (rhel-2.6.2.1.el7_1-x86_64 u91-b00)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)

$ free -h
     total     used     free   shared  buff/cache   available
Mem:  993M     609M      81M      14M        301M        231M
Swap: 1.5G       0B     1.5G

  Etienne

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://shibboleth.net/pipermail/users/attachments/20151120/0dd46182/attachment.sig>


More information about the users mailing list