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 <ohaya1...@gmail.com> 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 <ohaya1...@gmail.com> 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        used        free      shared  buff/cache
>> available
>> Mem:       32780604      913012    27429012       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        used        free      shared  buff/cache
>> available
>> Mem:       32780604     1343288    26998784       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 <ma...@apache.org> 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 <tom...@olafkock.de> 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
>>>
>>>

Reply via email to