Skip to main content

Customizing Java Virtual Machine

Customizing Java Virtual Machine

  • Customizing the catalina.sh
    • CATALINA_OPTS
     CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"
    
    • By default the CATALINA_OPTS line will looks like above. Among which the JPDA_OPTS is used to provide the debug options for the catalina script.
    • Now we need to edit this line and can add our custom options like the size of initial memory of JVM (min. size), the size of memory of the JVM (max. size) it can grow upto, garbage collection options, etc.
    • Add the below at the end of the CATALINA_OPTS line
     -Xms128m -Xmx256m 
     
    
    • -Xms means Extended Minimum Size which is the min / initial size of a JVM to start with
    • -Xmx means Extended Maximum Size which is the max size upto which a JVM can grow

Comments

Popular posts from this blog

Tomcat - Basic Clustering

Tomcat - Basic Clustering Till now we have 1 tomcat instance running and now we'll learn how to loadbalance multiple tomcat instances. For this let us have another tomcat instance configured first. Go to the  /opt  directory and copy  tomcat8  to  tomcat8-n2 # cp -prv tomcat8 tomcat8-n2 Now we know that we are using some ports for tomcat say 8080, 8005, 8009 For our additional tomcat instance we need to change the ports. If we don't then we might need to experience port conflict I am going to edit  server.xml  config file in the new node and increment the port numbers by 1 # cd /opt/tomcat8-n2/conf/ # vi server.xml 8005 -> 8006 8080 -> 8081 8443 -> 8444 8009 -> 8010 Now you need to add your new Catalina home, base and temp directories First you need to change the  catalina.sh  script and redirect the above 3 variables to the new variables Edit the  catalina.sh  script and add the following lines # vi...

CI-CD_004 - Git with Jenkins

Integrating Git with Jenkins If we are dealing with some specific code based builds where the code doesn't need any modification can be directly used for a build. But in some cases the code need to be changed several times depending on the need. In such case the periodic builds need to have those modifications. We use SCM (Source Code Management) to overcome this situation. And instead of manually copying the code to the build we can integrate the repositories from the SCM tools with our Jenkins builds. Configuration Global Settings In the Configure System page, the Git Plugin provides the following options: Global Config user.name Value: if provided git config user.name is called before builds. This can be overridden by individual projects. Global Config user.email Value: if provided git config user.email is called before builds. This can be overridden by individual projects. Create new accounts base on author/committer's email: if checked, upon parsing of git c...

Troubleshooting Tomcat using Catalina log

Troubleshooting Tomcat using Catalina log We can get the  catalina  logs in  $CATALINA_HOME/logs Here we'll have a  catalina.out We can see some huge info in that log file. If we want to what exactly happens since the start of tomcat then we need to log that into a new file. By default we have log rotation enabled on this logs. For now let us stop tomcat and nullify the catalina.out file and then start tomcat to have some new info in the catalina.out # service tomcat stop # cd $CATALINA_HOME/logs # :> catalina.out (or) cat /dev/null > catalina.out # ll catalina.out -rw-r----- 1 root root 0 Feb 18 16:19 catalina.out # service tomcat start # ll catalina.out -rw-r----- 1 root root 17341 Feb 18 16:21 catalina.out We can see the log being written after the start of tomcat. Now we can notice the instance giving some information about the starting of tomcat, about the configuration for the startup, path of the servlet instance for which the log is re...