Re: How to increase Memory available to Tomcat?
Using HugePages and -XX:+AlwaysPreTouch makes sure that all memory is allocated immediately. We've been using this for years to make sure our Java processes get access to all memory that would eventually be needed by the heap, metaspace, etc. Especially in order to avoid the effects of any unintended swapping, which effectively kills throughput whenever the garbage collector happens to run into memory pages that have been swapped out to disk. *Manuel Dominguez Sarmiento* On 01/04/2020 10:06, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jim, On 3/31/20 23:57, o haya wrote: I think I figured out what is going on. I think that the parameters were working all right, but the memory that is shown by the "free" command isn't corresponding to the JVM memory. I put together a small JSP that uses Runtime.getRuntime().totalMemory() and .freeMemory() and and when I access that page, that shows the JVM memory is as I configured with the Xmx/Xms. Yes, this is an error in your interpretation of your observations. Linux will lie, cheat, and steal in order to manage memory. It does that because processes lie, cheat, and steal, in order to get the resources they want. Some process says it needs a couple of gigs of RAM? Yeah, right, we'll believe it when we see it. Linux is doing its best to operate in an environment where processes often say they need resources that they don't actually use. In order to avoid prematurely running out of resources, the kernel will lie to the process and say the resources are available but not actually allocate them until the process tries to USE those resources. This is a Good Thing. free/ps/top/etc are telling you the truth. Java doesn't try to allocate the entire heap immediately, so Java thinks it can have all 4GiB of heap space and it will probably get it. But maybe not :) [1] - -chris [1] https://www.kernel.org/doc/gorman/html/understand/understand016.html On Tue, Mar 31, 2020 at 10:03 PM o haya wrote: Hi, BTW, in the catalina.out log file, I do see these lines: 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=UTF-8 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms4096m 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx4096m 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:NewSize=256m 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxNewSize=256m So from that logging, it seems like Tomcat IS seeing those parameters, so why does it not seem to be using the larger amounts of memory? Thanks, Jim On Tue, Mar 31, 2020 at 9:44 PM o haya wrote: Hi, I have Tomcat installed in /apps/apache-tomcat-9.0.20/ In the /apps/apache-tomcat-9.0.20/bin/setenv.sh, I have: #!/bin/bash JAVA_HOME=/apps/jdk1.8.0_221 CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:+DisableExplicitGC \ -Djava.security.egd=file:/dev/./urandom" Then to start Tomcat, I: cd /apps/apache-tomcat-9.0.20/ bin/startup.sh Here's an example of running: [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free total usedfree shared buff/cache available Mem: 32780604 91301227429012 16716 4438580 31441736 Swap: 0 0 0 [root@ip-192-168-218-224 apache-tomcat-9.0.20]# cd /apps/apache-tomcat-9.0.20/ [root@ip-192-168-218-224 apache-tomcat-9.0.20]# [root@ip-192-168-218-224 apache-tomcat-9.0.20]# bin/startup.sh Using CATALINA_BASE: /apps/apache-tomcat-9.0.20 Using CATALINA_HOME: /apps/apache-tomcat-9.0.20 Using CATALINA_TMPDIR: /apps/apache-tomcat-9.0.20/temp Using JRE_HOME: /apps/jdk1.8.0_221 Using CLASSPATH: /apps/apache-tomcat-9.0.20/bin/bootstrap.jar:/apps/apache-tomcat-9.0 .20/bin/tomcat-juli.jar Tomcat started. [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free total usedfree shared buff/cache available Mem: 32780604 134328826998784 16716 4438532 31011556 You are right that it appears like it is not using the CATALINA_OPTS to set the memory, but I don't know why ??? Thanks, Jim On Tue, Mar 31, 2020 at 12:52 PM Mark Thomas wrote: On 31/03/2020 17:42, o haya wrote: Thanks for the infos. I was thinking the same thing you were thinking, that it might be 32-bit JVM, but when I run "java -version" I am getting: java -version java version "1.8.0_221" Java(TM) SE Runtime Environment (build 1.8.0_221-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode) Isn't that confirming that this is a 64-bit JVM? ALSO FYI, I did test where I also added "-d64" parameter to the CATALINA_OPTS, and same thing happened. Exactly
Re: [OP but IMPORTANT!] How to increase Memory available to Tomcat?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Calder, On 4/1/20 08:52, calder wrote: > (BTW, I hope you're not running TC as the root user. I see > references to the root user in your CLI output) Great catch! Jim, the first think you should do without doing anything else is stop running at root. Right now. We'll wait. - -chris -BEGIN PGP SIGNATURE- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl6EkiUACgkQHPApP6U8 pFh53Q//ZCCbMbK+ELkfvykCyFGQIN6bDtEWp6k/YlyPYfb+rrpGseWXAOLP5hoL uUZExFSDvTSZJWiJ3RvqyQpgSan8QawWcesK+vbtCkmRZWv+iwuCMpLQw4auV5Ju R+UyME2ANvpissA8zFSZL/D65ytxHzZrF8cUOdy65horWQZ0MdS1b7wt9Q9LC2E3 9dYjb8Sv+31nSUi+umtaMRgSlfbNqpQ/V3WaEzys9hm3OWoak+yHDs+jywU5rx0P tzaN/mhgCsrheDI+7sdrdK5onVKX4AbwQmrE1GrTQqzRpa4C7Y+NAt2TaUfQwQw3 C9APJnp2VzPNcERDouCipN7klRMVZTD6A5hwfht3/xQh6Ab59Or3IamMFt20VjHe JcDMVr7OIADZ5ayuCRmyWdTeAqmGAQuMmblpKJ99Eb0Tw+Ms0Dsn/SOk2Of8E7oF jlO0o5xXSJSNiUVYBJli3Yw2E5b9y30FF393jxIg64tMbnSYRTwLgd9xiE+Rg0Jz an+NRQ4jfBcOVl6B7jQEbTgSIud3RELtadp0ugimdMUoUFYYRM+8ulnQR/rlTBVt zTBR/ieTOecfh2yQ5cvt4Bvi3YXfUmcLqpgd9lp3zQOES+fmays3oIl7dj+G0dJX QnYQjUgJp+sFS3WGUiY8UMarnd3x8BacN8s+2zXUs95HmYPqeK8= =8aUr -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to increase Memory available to Tomcat?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jim, On 3/31/20 23:57, o haya wrote: > I think I figured out what is going on. I think that the > parameters were working all right, but the memory that is shown by > the "free" command isn't corresponding to the JVM memory. > > I put together a small JSP that uses > Runtime.getRuntime().totalMemory() and .freeMemory() and and when I > access that page, that shows the JVM memory is as I configured with > the Xmx/Xms. Yes, this is an error in your interpretation of your observations. Linux will lie, cheat, and steal in order to manage memory. It does that because processes lie, cheat, and steal, in order to get the resources they want. Some process says it needs a couple of gigs of RAM? Yeah, right, we'll believe it when we see it. Linux is doing its best to operate in an environment where processes often say they need resources that they don't actually use. In order to avoid prematurely running out of resources, the kernel will lie to the process and say the resources are available but not actually allocate them until the process tries to USE those resources. This is a Good Thing. free/ps/top/etc are telling you the truth. Java doesn't try to allocate the entire heap immediately, so Java thinks it can have all 4GiB of heap space and it will probably get it. But maybe not :) [1] - -chris [1] https://www.kernel.org/doc/gorman/html/understand/understand016.html > On Tue, Mar 31, 2020 at 10:03 PM o haya > wrote: > >> Hi, >> >> BTW, in the catalina.out log file, I do see these lines: >> >> 01-Apr-2020 01:53:17.775 INFO [main] >> org.apache.catalina.startup.VersionLoggerListener.log Command >> line argument: -Dfile.encoding=UTF-8 01-Apr-2020 01:53:17.775 >> INFO [main] org.apache.catalina.startup.VersionLoggerListener.log >> Command line argument: -Xms4096m 01-Apr-2020 01:53:17.775 INFO >> [main] org.apache.catalina.startup.VersionLoggerListener.log >> Command line argument: -Xmx4096m 01-Apr-2020 01:53:17.775 INFO >> [main] org.apache.catalina.startup.VersionLoggerListener.log >> Command line argument: -XX:NewSize=256m 01-Apr-2020 01:53:17.775 >> INFO [main] org.apache.catalina.startup.VersionLoggerListener.log >> Command line argument: -XX:MaxNewSize=256m >> >> So from that logging, it seems like Tomcat IS seeing those >> parameters, so why does it not seem to be using the larger >> amounts of memory? >> >> Thanks, Jim >> >> >> On Tue, Mar 31, 2020 at 9:44 PM o haya >> wrote: >> >>> Hi, >>> >>> I have Tomcat installed in /apps/apache-tomcat-9.0.20/ >>> >>> In the /apps/apache-tomcat-9.0.20/bin/setenv.sh, I have: >>> >>> #!/bin/bash >>> >>> JAVA_HOME=/apps/jdk1.8.0_221 >>> >>> CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 >>> -server \ -Xms4096m -Xmx4096m -XX:NewSize=256m >>> -XX:MaxNewSize=256m -XX:+DisableExplicitGC \ >>> -Djava.security.egd=file:/dev/./urandom" >>> >>> >>> Then to start Tomcat, I: >>> >>> cd /apps/apache-tomcat-9.0.20/ >>> >>> bin/startup.sh >>> >>> >>> >>> Here's an example of running: >>> >>> [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free total >>> usedfree shared buff/cache available Mem: >>> 32780604 91301227429012 16716 4438580 >>> 31441736 Swap: 0 0 0 >>> [root@ip-192-168-218-224 apache-tomcat-9.0.20]# cd >>> /apps/apache-tomcat-9.0.20/ [root@ip-192-168-218-224 >>> apache-tomcat-9.0.20]# [root@ip-192-168-218-224 >>> apache-tomcat-9.0.20]# bin/startup.sh Using CATALINA_BASE: >>> /apps/apache-tomcat-9.0.20 Using CATALINA_HOME: >>> /apps/apache-tomcat-9.0.20 Using CATALINA_TMPDIR: >>> /apps/apache-tomcat-9.0.20/temp Using JRE_HOME: >>> /apps/jdk1.8.0_221 Using CLASSPATH: >>> /apps/apache-tomcat-9.0.20/bin/bootstrap.jar:/apps/apache-tomcat-9.0 .20/bin/tomcat-juli.jar >>> >>> Tomcat started. >>> [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free total >>> usedfree shared buff/cache available Mem: >>> 32780604 134328826998784 16716 4438532 >>> 31011556 >>> >>> >>> >>> You are right that it appears like it is not using the >>> CATALINA_OPTS to set the memory, but I don't know why ??? >>> >>> >>> Thanks, Jim >>> >>> >>> >>> >>> >>> On Tue, Mar 31, 2020 at 12:52 PM Mark Thomas >>> wrote: >>> On 31/03/2020 17:42, o haya wrote: > Thanks for the infos. > > I was thinking the same thing you were thinking, that it > might be 32-bit > JVM, but when I run "java -version" I am getting: > > java -version java version "1.8.0_221" Java(TM) SE Runtime > Environment (build 1.8.0_221-b11) Java HotSpot(TM) 64-Bit > Server VM (build 25.221-b11, mixed mode) > > Isn't that confirming that this is a 64-bit JVM? > > ALSO FYI, I did test where I also added "-d64" parameter to > the CATALINA_OPTS, and same thing happened. Exactly how are you setting those? It looks like the changes you are making aren't having any effect. If you specified a 4Gb min heap
Re: How to increase Memory available to Tomcat?
On Tue, Mar 31, 2020 at 10:57 PM o haya wrote: > I think I figured out what is going on. I think that the parameters were > working all right, but the memory that is shown by the "free" command isn't > corresponding to the JVM memory. [ snip ] You beat me to the punch. Linux "free" cannot be used reliably in some situations, esp with Java. (BTW, I hope you're not running TC as the root user. I see references to the root user in your CLI output) You could use the visual (GUI) tools, such as "jvisualvm" or "Mission Control" (jmc). Both of these provide a wealth of JVM memory usage, including GC. You could also query for the info at the command line * using "jps -lvm" (NOTE: this is without the facility of JMX) * you could run: java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize' for example (output) user@stimpy:~/bin/jdk180-221/bin> java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize' intx CompilerThreadStackSize = 1024 {pd product} {default} size_t ErgoHeapSizeLimit= 0 {product} {default} size_t HeapSizePerGCThread = 43620760 {product} {default} size_t InitialHeapSize = 1052770304 {product} {ergonomic} size_t LargePageHeapSizeThreshold = 134217728 {product} {default} size_t MaxHeapSize = 16835936256 {product} {ergonomic} uintx NonNMethodCodeHeapSize = 7594288 {pd product} {ergonomic} uintx NonProfiledCodeHeapSize = 122031976 {pd product} {ergonomic} uintx ProfiledCodeHeapSize = 122031976 {pd product} {ergonomic} intx ThreadStackSize = 1024 {pd product} {default} intx VMThreadStackSize= 1024 {pd product} {default} openjdk version "11.0.6" 2020-01-14 OpenJDK Runtime Environment (build 11.0.6+10-suse-2.1-x8664) OpenJDK 64-Bit Server VM (build 11.0.6+10-suse-2.1-x8664, mixed mode) user@stimpy:~/bin/jdk180-221/bin> - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to increase Memory available to Tomcat?
Hi, I think I figured out what is going on. I think that the parameters were working all right, but the memory that is shown by the "free" command isn't corresponding to the JVM memory. I put together a small JSP that uses Runtime.getRuntime().totalMemory() and .freeMemory() and and when I access that page, that shows the JVM memory is as I configured with the Xmx/Xms. Thanks, Jim On Tue, Mar 31, 2020 at 10:03 PM o haya wrote: > Hi, > > BTW, in the catalina.out log file, I do see these lines: > > 01-Apr-2020 01:53:17.775 INFO [main] > org.apache.catalina.startup.VersionLoggerListener.log Command line > argument: -Dfile.encoding=UTF-8 > 01-Apr-2020 01:53:17.775 INFO [main] > org.apache.catalina.startup.VersionLoggerListener.log Command line > argument: -Xms4096m > 01-Apr-2020 01:53:17.775 INFO [main] > org.apache.catalina.startup.VersionLoggerListener.log Command line > argument: -Xmx4096m > 01-Apr-2020 01:53:17.775 INFO [main] > org.apache.catalina.startup.VersionLoggerListener.log Command line > argument: -XX:NewSize=256m > 01-Apr-2020 01:53:17.775 INFO [main] > org.apache.catalina.startup.VersionLoggerListener.log Command line > argument: -XX:MaxNewSize=256m > > So from that logging, it seems like Tomcat IS seeing those parameters, so > why does it not seem to be using the larger amounts of memory? > > Thanks, > Jim > > > On Tue, Mar 31, 2020 at 9:44 PM o haya wrote: > >> Hi, >> >> I have Tomcat installed in /apps/apache-tomcat-9.0.20/ >> >> In the /apps/apache-tomcat-9.0.20/bin/setenv.sh, I have: >> >> #!/bin/bash >> >> JAVA_HOME=/apps/jdk1.8.0_221 >> >> CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ >> -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m >> -XX:+DisableExplicitGC \ >> -Djava.security.egd=file:/dev/./urandom" >> >> >> Then to start Tomcat, I: >> >> cd /apps/apache-tomcat-9.0.20/ >> >> bin/startup.sh >> >> >> >> Here's an example of running: >> >> [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free >> totalusedfree shared buff/cache >> available >> Mem: 32780604 91301227429012 16716 4438580 >> 31441736 >> Swap: 0 0 0 >> [root@ip-192-168-218-224 apache-tomcat-9.0.20]# cd >> /apps/apache-tomcat-9.0.20/ >> [root@ip-192-168-218-224 apache-tomcat-9.0.20]# >> [root@ip-192-168-218-224 apache-tomcat-9.0.20]# bin/startup.sh >> Using CATALINA_BASE: /apps/apache-tomcat-9.0.20 >> Using CATALINA_HOME: /apps/apache-tomcat-9.0.20 >> Using CATALINA_TMPDIR: /apps/apache-tomcat-9.0.20/temp >> Using JRE_HOME:/apps/jdk1.8.0_221 >> Using CLASSPATH: >> /apps/apache-tomcat-9.0.20/bin/bootstrap.jar:/apps/apache-tomcat-9.0.20/bin/tomcat-juli.jar >> Tomcat started. >> [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free >> totalusedfree shared buff/cache >> available >> Mem: 32780604 134328826998784 16716 4438532 >> 31011556 >> >> >> >> You are right that it appears like it is not using the CATALINA_OPTS to >> set the memory, but I don't know why ??? >> >> >> Thanks, >> Jim >> >> >> >> >> >> On Tue, Mar 31, 2020 at 12:52 PM Mark Thomas wrote: >> >>> On 31/03/2020 17:42, o haya wrote: >>> > Thanks for the infos. >>> > >>> > I was thinking the same thing you were thinking, that it might be >>> 32-bit >>> > JVM, but when I run "java -version" I am getting: >>> > >>> > java -version >>> > java version "1.8.0_221" >>> > Java(TM) SE Runtime Environment (build 1.8.0_221-b11) >>> > Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode) >>> > >>> > Isn't that confirming that this is a 64-bit JVM? >>> > >>> > ALSO FYI, I did test where I also added "-d64" parameter to the >>> > CATALINA_OPTS, and same thing happened. >>> >>> Exactly how are you setting those? It looks like the changes you are >>> making aren't having any effect. If you specified a 4Gb min heap on a >>> 32-bit JVM I'd expect Java to either refuse to start or crash on start. >>> >>> Mark >>> >>> >>> > >>> > Jim >>> > >>> > On Tue, Mar 31, 2020 at 11:10 AM Olaf Kock wrote: >>> > >>> >> >>> >> On 31.03.20 17:02, o haya wrote: >>> >>> Hi, >>> >>> >>> >>> I am running Tomcat 9.02 under RHEL 7 (under Oracle JDK 1.8), and I >>> would >>> >>> like to increase the memory that is available to Tomcat when it is >>> >> running. >>> >>> >>> >>> I have tried sourcing the following: >>> >>> >>> >>> JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ >>> >>> -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m >>> >>> -XX:+DisableExplicitGC \ >>> >>> -Djava.security.egd=file:/dev/./urandom -d64" >>> >> >>> >> You want to use CATALINA_OPTS for memory settings, not JAVA_OPTS. >>> >> >>> >> JAVA_OPTS are used for every JVM start, including when you run >>> >> shutdown.sh - that one needs only a minimal amount of memory for short >>> >> time. >>> >> >>> >>> and also: >>> >>> >>> >>> CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
Re: How to increase Memory available to Tomcat?
Hi, BTW, in the catalina.out log file, I do see these lines: 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=UTF-8 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms4096m 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx4096m 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:NewSize=256m 01-Apr-2020 01:53:17.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxNewSize=256m So from that logging, it seems like Tomcat IS seeing those parameters, so why does it not seem to be using the larger amounts of memory? Thanks, Jim On Tue, Mar 31, 2020 at 9:44 PM o haya wrote: > Hi, > > I have Tomcat installed in /apps/apache-tomcat-9.0.20/ > > In the /apps/apache-tomcat-9.0.20/bin/setenv.sh, I have: > > #!/bin/bash > > JAVA_HOME=/apps/jdk1.8.0_221 > > CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ > -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m > -XX:+DisableExplicitGC \ > -Djava.security.egd=file:/dev/./urandom" > > > Then to start Tomcat, I: > > cd /apps/apache-tomcat-9.0.20/ > > bin/startup.sh > > > > Here's an example of running: > > [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free > totalusedfree shared buff/cache > available > Mem: 32780604 91301227429012 16716 4438580 > 31441736 > Swap: 0 0 0 > [root@ip-192-168-218-224 apache-tomcat-9.0.20]# cd > /apps/apache-tomcat-9.0.20/ > [root@ip-192-168-218-224 apache-tomcat-9.0.20]# > [root@ip-192-168-218-224 apache-tomcat-9.0.20]# bin/startup.sh > Using CATALINA_BASE: /apps/apache-tomcat-9.0.20 > Using CATALINA_HOME: /apps/apache-tomcat-9.0.20 > Using CATALINA_TMPDIR: /apps/apache-tomcat-9.0.20/temp > Using JRE_HOME:/apps/jdk1.8.0_221 > Using CLASSPATH: > /apps/apache-tomcat-9.0.20/bin/bootstrap.jar:/apps/apache-tomcat-9.0.20/bin/tomcat-juli.jar > Tomcat started. > [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free > totalusedfree shared buff/cache > available > Mem: 32780604 134328826998784 16716 4438532 > 31011556 > > > > You are right that it appears like it is not using the CATALINA_OPTS to > set the memory, but I don't know why ??? > > > Thanks, > Jim > > > > > > On Tue, Mar 31, 2020 at 12:52 PM Mark Thomas wrote: > >> On 31/03/2020 17:42, o haya wrote: >> > Thanks for the infos. >> > >> > I was thinking the same thing you were thinking, that it might be 32-bit >> > JVM, but when I run "java -version" I am getting: >> > >> > java -version >> > java version "1.8.0_221" >> > Java(TM) SE Runtime Environment (build 1.8.0_221-b11) >> > Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode) >> > >> > Isn't that confirming that this is a 64-bit JVM? >> > >> > ALSO FYI, I did test where I also added "-d64" parameter to the >> > CATALINA_OPTS, and same thing happened. >> >> Exactly how are you setting those? It looks like the changes you are >> making aren't having any effect. If you specified a 4Gb min heap on a >> 32-bit JVM I'd expect Java to either refuse to start or crash on start. >> >> Mark >> >> >> > >> > Jim >> > >> > On Tue, Mar 31, 2020 at 11:10 AM Olaf Kock wrote: >> > >> >> >> >> On 31.03.20 17:02, o haya wrote: >> >>> Hi, >> >>> >> >>> I am running Tomcat 9.02 under RHEL 7 (under Oracle JDK 1.8), and I >> would >> >>> like to increase the memory that is available to Tomcat when it is >> >> running. >> >>> >> >>> I have tried sourcing the following: >> >>> >> >>> JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ >> >>> -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m >> >>> -XX:+DisableExplicitGC \ >> >>> -Djava.security.egd=file:/dev/./urandom -d64" >> >> >> >> You want to use CATALINA_OPTS for memory settings, not JAVA_OPTS. >> >> >> >> JAVA_OPTS are used for every JVM start, including when you run >> >> shutdown.sh - that one needs only a minimal amount of memory for short >> >> time. >> >> >> >>> and also: >> >>> >> >>> CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server >> \ >> >>> -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m >> >>> -XX:+DisableExplicitGC \ >> >>> -Djava.security.egd=file:/dev/./urandom" >> >> >> >> your CATALINA_OPTS will be combined with the JAVA_OPTS, so that you >> >> configure the memory twice. >> >> >> >> But -Xms and -Xmx are the way to configure the memory. >> >> >> >>> but even with those, when I check memory using "free", it is only >> using >> >>> about 1.5GB. >> >>> >> >>> Can someone tell me how I can accomplish this? >> >> >> >> Sounds suspiciously like you're running on 32bit, either the OS or JVM. >> >> Upgrade to 6
Re: How to increase Memory available to Tomcat?
Hi, I have Tomcat installed in /apps/apache-tomcat-9.0.20/ In the /apps/apache-tomcat-9.0.20/bin/setenv.sh, I have: #!/bin/bash JAVA_HOME=/apps/jdk1.8.0_221 CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:+DisableExplicitGC \ -Djava.security.egd=file:/dev/./urandom" Then to start Tomcat, I: cd /apps/apache-tomcat-9.0.20/ bin/startup.sh Here's an example of running: [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free totalusedfree shared buff/cache available Mem: 32780604 91301227429012 16716 4438580 31441736 Swap: 0 0 0 [root@ip-192-168-218-224 apache-tomcat-9.0.20]# cd /apps/apache-tomcat-9.0.20/ [root@ip-192-168-218-224 apache-tomcat-9.0.20]# [root@ip-192-168-218-224 apache-tomcat-9.0.20]# bin/startup.sh Using CATALINA_BASE: /apps/apache-tomcat-9.0.20 Using CATALINA_HOME: /apps/apache-tomcat-9.0.20 Using CATALINA_TMPDIR: /apps/apache-tomcat-9.0.20/temp Using JRE_HOME:/apps/jdk1.8.0_221 Using CLASSPATH: /apps/apache-tomcat-9.0.20/bin/bootstrap.jar:/apps/apache-tomcat-9.0.20/bin/tomcat-juli.jar Tomcat started. [root@ip-192-168-218-224 apache-tomcat-9.0.20]# free totalusedfree shared buff/cache available Mem: 32780604 134328826998784 16716 4438532 31011556 You are right that it appears like it is not using the CATALINA_OPTS to set the memory, but I don't know why ??? Thanks, Jim On Tue, Mar 31, 2020 at 12:52 PM Mark Thomas wrote: > On 31/03/2020 17:42, o haya wrote: > > Thanks for the infos. > > > > I was thinking the same thing you were thinking, that it might be 32-bit > > JVM, but when I run "java -version" I am getting: > > > > java -version > > java version "1.8.0_221" > > Java(TM) SE Runtime Environment (build 1.8.0_221-b11) > > Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode) > > > > Isn't that confirming that this is a 64-bit JVM? > > > > ALSO FYI, I did test where I also added "-d64" parameter to the > > CATALINA_OPTS, and same thing happened. > > Exactly how are you setting those? It looks like the changes you are > making aren't having any effect. If you specified a 4Gb min heap on a > 32-bit JVM I'd expect Java to either refuse to start or crash on start. > > Mark > > > > > > Jim > > > > On Tue, Mar 31, 2020 at 11:10 AM Olaf Kock wrote: > > > >> > >> On 31.03.20 17:02, o haya wrote: > >>> Hi, > >>> > >>> I am running Tomcat 9.02 under RHEL 7 (under Oracle JDK 1.8), and I > would > >>> like to increase the memory that is available to Tomcat when it is > >> running. > >>> > >>> I have tried sourcing the following: > >>> > >>> JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ > >>> -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m > >>> -XX:+DisableExplicitGC \ > >>> -Djava.security.egd=file:/dev/./urandom -d64" > >> > >> You want to use CATALINA_OPTS for memory settings, not JAVA_OPTS. > >> > >> JAVA_OPTS are used for every JVM start, including when you run > >> shutdown.sh - that one needs only a minimal amount of memory for short > >> time. > >> > >>> and also: > >>> > >>> CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ > >>> -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m > >>> -XX:+DisableExplicitGC \ > >>> -Djava.security.egd=file:/dev/./urandom" > >> > >> your CATALINA_OPTS will be combined with the JAVA_OPTS, so that you > >> configure the memory twice. > >> > >> But -Xms and -Xmx are the way to configure the memory. > >> > >>> but even with those, when I check memory using "free", it is only using > >>> about 1.5GB. > >>> > >>> Can someone tell me how I can accomplish this? > >> > >> Sounds suspiciously like you're running on 32bit, either the OS or JVM. > >> Upgrade to 64bit to have access to more memory. > >> > >> > >> > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > >> For additional commands, e-mail: users-h...@tomcat.apache.org > >> > >> > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: How to increase Memory available to Tomcat?
On 31/03/2020 17:42, o haya wrote: > Thanks for the infos. > > I was thinking the same thing you were thinking, that it might be 32-bit > JVM, but when I run "java -version" I am getting: > > java -version > java version "1.8.0_221" > Java(TM) SE Runtime Environment (build 1.8.0_221-b11) > Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode) > > Isn't that confirming that this is a 64-bit JVM? > > ALSO FYI, I did test where I also added "-d64" parameter to the > CATALINA_OPTS, and same thing happened. Exactly how are you setting those? It looks like the changes you are making aren't having any effect. If you specified a 4Gb min heap on a 32-bit JVM I'd expect Java to either refuse to start or crash on start. Mark > > Jim > > On Tue, Mar 31, 2020 at 11:10 AM Olaf Kock wrote: > >> >> On 31.03.20 17:02, o haya wrote: >>> Hi, >>> >>> I am running Tomcat 9.02 under RHEL 7 (under Oracle JDK 1.8), and I would >>> like to increase the memory that is available to Tomcat when it is >> running. >>> >>> I have tried sourcing the following: >>> >>> JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ >>> -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m >>> -XX:+DisableExplicitGC \ >>> -Djava.security.egd=file:/dev/./urandom -d64" >> >> You want to use CATALINA_OPTS for memory settings, not JAVA_OPTS. >> >> JAVA_OPTS are used for every JVM start, including when you run >> shutdown.sh - that one needs only a minimal amount of memory for short >> time. >> >>> and also: >>> >>> CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ >>> -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m >>> -XX:+DisableExplicitGC \ >>> -Djava.security.egd=file:/dev/./urandom" >> >> your CATALINA_OPTS will be combined with the JAVA_OPTS, so that you >> configure the memory twice. >> >> But -Xms and -Xmx are the way to configure the memory. >> >>> but even with those, when I check memory using "free", it is only using >>> about 1.5GB. >>> >>> Can someone tell me how I can accomplish this? >> >> Sounds suspiciously like you're running on 32bit, either the OS or JVM. >> Upgrade to 64bit to have access to more memory. >> >> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> >> > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to increase Memory available to Tomcat?
Thanks for the infos. I was thinking the same thing you were thinking, that it might be 32-bit JVM, but when I run "java -version" I am getting: java -version java version "1.8.0_221" Java(TM) SE Runtime Environment (build 1.8.0_221-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode) Isn't that confirming that this is a 64-bit JVM? ALSO FYI, I did test where I also added "-d64" parameter to the CATALINA_OPTS, and same thing happened. Jim On Tue, Mar 31, 2020 at 11:10 AM Olaf Kock wrote: > > On 31.03.20 17:02, o haya wrote: > > Hi, > > > > I am running Tomcat 9.02 under RHEL 7 (under Oracle JDK 1.8), and I would > > like to increase the memory that is available to Tomcat when it is > running. > > > > I have tried sourcing the following: > > > > JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ > > -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m > > -XX:+DisableExplicitGC \ > > -Djava.security.egd=file:/dev/./urandom -d64" > > You want to use CATALINA_OPTS for memory settings, not JAVA_OPTS. > > JAVA_OPTS are used for every JVM start, including when you run > shutdown.sh - that one needs only a minimal amount of memory for short > time. > > > and also: > > > > CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ > > -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m > > -XX:+DisableExplicitGC \ > > -Djava.security.egd=file:/dev/./urandom" > > your CATALINA_OPTS will be combined with the JAVA_OPTS, so that you > configure the memory twice. > > But -Xms and -Xmx are the way to configure the memory. > > > but even with those, when I check memory using "free", it is only using > > about 1.5GB. > > > > Can someone tell me how I can accomplish this? > > Sounds suspiciously like you're running on 32bit, either the OS or JVM. > Upgrade to 64bit to have access to more memory. > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: How to increase Memory available to Tomcat?
On 31.03.20 17:02, o haya wrote: > Hi, > > I am running Tomcat 9.02 under RHEL 7 (under Oracle JDK 1.8), and I would > like to increase the memory that is available to Tomcat when it is running. > > I have tried sourcing the following: > > JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ > -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m > -XX:+DisableExplicitGC \ > -Djava.security.egd=file:/dev/./urandom -d64" You want to use CATALINA_OPTS for memory settings, not JAVA_OPTS. JAVA_OPTS are used for every JVM start, including when you run shutdown.sh - that one needs only a minimal amount of memory for short time. > and also: > > CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ > -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m > -XX:+DisableExplicitGC \ > -Djava.security.egd=file:/dev/./urandom" your CATALINA_OPTS will be combined with the JAVA_OPTS, so that you configure the memory twice. But -Xms and -Xmx are the way to configure the memory. > but even with those, when I check memory using "free", it is only using > about 1.5GB. > > Can someone tell me how I can accomplish this? Sounds suspiciously like you're running on 32bit, either the OS or JVM. Upgrade to 64bit to have access to more memory. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
How to increase Memory available to Tomcat?
Hi, I am running Tomcat 9.02 under RHEL 7 (under Oracle JDK 1.8), and I would like to increase the memory that is available to Tomcat when it is running. I have tried sourcing the following: JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:+DisableExplicitGC \ -Djava.security.egd=file:/dev/./urandom -d64" and also: CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server \ -Xms4096m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:+DisableExplicitGC \ -Djava.security.egd=file:/dev/./urandom" but even with those, when I check memory using "free", it is only using about 1.5GB. Can someone tell me how I can accomplish this? Thanks, Jim