Skip to main content

Tomcat Optimization

Remove every unwanted installed application
This will save you startup time, as well as memory used by preloaded servlets. Web-application which comes with tomcat are :
  1. jsp-examples
  2. balancer
  3. tomcat-docs
  4. webdav
  5. servlets-examples.
  6. manager
  7. host-manager
  8. ROOT
Don't delete (if needed ) :-
  1. manager and host-manager :- one can utilize them to upload application dynamically without stopping tomcat server. We need to set autoDeploy to true to make use of manager applications.
  2. balancer :- it provides clustering and load balancing capabilities that are essential for deploying scalable and robust web applications.

Changes in Server.XML

Set the autodeploy attribute of the tag to false (unless you need any of the default Tomcat applications like Tomcat Manager). Setting autoDeploy and unpackWARS to false as we are not deploying and updating web applications dynamically. We are also not using the default Tomcat applications like Tomcat Manager for dynamically web application deployment.


Changes in context.XML

Setting reloadable attribute to false.
*reloadable*:-Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

Changes in other web applications (which are not so important to you)
  1. Commenting tag from web.xml. This action will not allow to eat our limited memory as soon as tomcat will start. The related servlet will be loaded when the container decides it needs to be loaded - typically on it's first access.
  2. Setting reloadable attribute to false in context.xml file

Others
  1. If the garbage collector has become a bottleneck, we may be able to improve performance by customizing the generation sizes.
  2. Turn off JSP development mode in production by setting the development parameter of the jsp servlet to false

Comments

Popular posts from this blog

Java and “\u” ( blackslash u )

This article is related to escaping of “\u” backslash u [Unicode character] in Java Problem Statement: I have a string which consists of a DOS path something like "\sample\user_data\example".The “\u” (backslash u) in “\user_data” above gives “an invalid Unicode” JavaScript error in IE and hence my page isn’t displayed. I tried to replace “\u” (backslash u) in the string with something like "\ u"(backslash u) as I was not able to escape it. This also does not work . Java complier does not allow “\u” (backslash u) character and gives "Invalid unicode character sequence" error when I use it with replaceAll. Que 1: Can I escape the \u character some how in Java or JavaScript? Que 2: How can I replace all "\u" character in a string with something else like "\ u"? I have posted this query to some of the Java and JavaScript related groups. Here are the solutions I found Before going into the details about solution let us

MySQL :: tinyInt1isBit

One can enter values apart from 0 and 1 (say 2,3,?100) in a field with tinyint(1) type in MySql. MySql doesn?t complain. Now if you want to read inserted data using PHP it will return value as it is, however this will not work with Java. Java will throw an exception while reading same MySql data. Java treats tinyint(1) as Boolean and returns only true or false. Two solution either we can make our column tinyint(something > 1), or can add the connection property 'tinyInt1isBit=false' to our JDBC URL. Adding connection property 'tinyInt1isBit=false' to JDBC URL is risky since it will affect entire database data while reading the same using Java. Refer : http://forums.mysql.com/read.php?39,10652,10669#msg-10669

Every thing about ConcurrentHashMap

Why ConcurrentHashMap is better than Hashtable and just as good as a HashMap http://www.codercorp.com/blog/java/why-concurrenthashmap-is-better-than-hashtable-and-just-as-good-hashmap.html Why ConcurrentHashMap does not support null values http://anshuiitk.blogspot.com/2010/12/why-concurrenthashmap-does-not-support.html