go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Increase Tomcat JVM Heap Memory
 
Subject: Increase Tomcat JVM Heap Memory
Author: AwsEC2
In response to: Upgrade Tomcat to Version 7u68
Posted on: 04/20/2016 11:52:41 PM


It turns out that Tomcat has the default memory setting of around 128MB. If you web application needs more memory to run within the Tomcat container, it is VERY IMPORTANT to increase the heap memory for Tomcat in file "bin/catalina.sh" as shown below:

        CATALINA_OPTS="$CATALINA_OPTS -Xms128M -Xmx512M"




 

> On 04/20/2016 11:39:47 PM AwsEC2 wrote:

Download and unpack Tomcat 7

# mkdir /env
# mkdir /env/tomcat
# cd /env/tomcat
# curl http://apache.go-parts.com/tomcat/tomcat-7/v7.0.68/bin/apache-tomcat-7.0.68.tar.gz >
 apache-tomcat-7.0.68.tar.gz
# tar zxvf apache-tomcat-7.0.68.tar.gz


Configure Tomcat 7

Modify the file "/etc/rc.d/init.d/tomcat" accordingly:
#!/bin/sh
# Tomcat init script for Linux.
#
# chkconfig: 2345 96 14
# description: The Apache Tomcat servlet/JSP container.

JAVA_HOME=/opt/jdk1.7.0_79
CATALINA_HOME=/env/tomcat/apache-tomcat-7.0.68
export JAVA_HOME CATALINA_HOME

exec $CATALINA_HOME/bin/catalina.sh $*


Build Local .war file

  • Step 1. Use Eclipse Export tool to generate your project .war file;
  • Step 2. Use 7-z archive tool to remove your data: conf,data,install (this is a update)
  • Step 3. Upload by WinScp your modified .war unto /env/tomcat/apache-tomcat-7.0.68/webapps/

    Migrate customer's data

  • Step 1. Shutdow your old Tomcat: ./apache-tomcat-x.x.xx/bin/shutdown.sh
  • Step 2. Start your new Tomcat: ./apache-tomcat-7.0.68/bin/startup.sh to deploy your .war contents
  • Step 3. Shutdown ./apache-tomcat-7.0.68/bin/shutdown.sh
  • Step 4. Copy the removed parts:
    # cp -rf apache-tomcat-x.x.xx/webapps/myContext/data apache-tomcat-7.0.68/webapps/myContext/
    # cp -rf apache-tomcat-x.x.xx/webapps/myContext/conf apache-tomcat-7.0.68/webapps/myContext/
  • Step 5. Modify apache-tomcat-7.0.68/webapps/myContext/conf by adding additional settings
  • Step 6. Start your new Tomcat: ./apache-tomcat-7.0.68/bin/startup.sh






    References:

  •  


     
    Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.