TomcatExpert

Operations

Blog : Using the Tomcat 7 JDBC Connection Pool in Production

posted by dmikusa on January 23, 2012 03:14 PM

One of the new features with Tomcat 7 is a replacement to the commons-dbcp connection pool. While the commons-dbcp connection pool works fine for small or low traffic applications, it is known to have problems in highly concurrent environments (think multi-core/multi-cpu).

Fortunately, this is where the JDBC Connection Pool excels. It is a completely new connection pool which has been written from the ground up, with a focus on highly concurrent environments and performance.

Given its focus on high concurrency and performance, many users are finding that the JDBC Connection Pool can be great for use in a production environment. This article will discuss the features and options which make using the JDBC Connection Pool a great choice.

The Basics

Getting started with the JDBC Connection Pool is very simple. It was purposefully designed as a drop-in replacement for commons-dbcp and as such, if you've ever used commons-dbcp you'll be immediately familiar with the configuration for the JDBC Connection Pool.

This means the most existing commons-dbcp users can switch to the JDBC Connection Pool by simply adding the following property to their configuration factory=”org.apache.tomcat.jdbc.pool.DataSourceFactory”.

What about the other commons-dbcp configuration options? You don't need to change them at all. Virtually all of the commons-dbcp configuration options are supported by the JDBC Connection Pool. Including but not limited to: testWhileIdle, testOnBorrow, testOnReturn, maxActive, minIdle, maxWait, initialSize, removeAbandoned, removeAbandonedTimeout and logAbandoned.

Read More

1 comments   |  

0
Rating
  |  

Operations | Apache Tomcat 7, jdbc-pool

Blog : Apache Tomcat 7.0.25 released

posted by Stacey Schneider on January 23, 2012 10:47 AM

The Apache Tomcat team announces the immediate availability of Apache Tomcat 7.0.25

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This release includes numerous bug fixes and several new features compared to version 7.0.23. The notable new features include:

  • Align the Servlet 3.0 implementation with the changes defined in the first maintenance release (also known as Rev. A.). See the JCP documentation for a detailed list of changes.
  • Add support for connectors to automatically select a free port to bind to. This is useful when embedding and for testing.
  • Update to Commons Pool 1.5.7, Commons Daemon 1.0.8 and Eclipse JDT compiler 3.7.1.

Read More

1 comments   |  

0
Rating
  |  

Developers, Operations | Apache Tomcat 7

Ask the Experts : Tomcat 7 and Parallel Deployment

We are trying to deploy 2 versions of the same application on Tomcat 7 to test its parallel deployment features for our application.

Not meeting with success, I was looking for  a definitive guide for parallel deployment on Tomcat 7.

 

Our application is a JSP based application but we can have changes often.

asked by csaoin

question

The definitive reference for parallel deployment comes directly from the Apache Software Foundation: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment.

Additionally, Mark Thomas wrote a summary article explaining how this feature works on the Context Container and across clusters: http://www.tomcatexpert.com/blog/2011/05/31/parallel-deployment-tomcat-7.

answered by SpringSource on January 6, 2012 07:13 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Developers, Operations | Parallel Deployment, Tomcat 7, Tomcat Configuration

Blog : Year in Review 2011

posted by Stacey Schneider on January 4, 2012 07:31 AM

2011 has been a great year for the Tomcat Expert community. After almost 2 years of operating, the Tomcat Expert has hit its stride, unloading an array of new information, as well as keeping you up to date with the newest releases for Apache Tomcat 6 and Apache Tomcat 7. With the addition of two new Tomcat Expert Contributors, (Channing Benson and Daniel Mikusa), the Tomcat Expert community continues to build on its reputation for being the leading source for fresh perspectives and new information on how to best leverage Apache Tomcat in the enterprise.

Read More

0 comments   |  

0
Rating
  |  

Developers, Executives | Apache Tomcat 6, Apache Tomcat 7, Cross-site Scripting

Ask the Experts : Configure Tomcat Memory Settings

Need to configure a linux (RedHat AS4) Tomcat 6.0.32 server's memory settings. After reviewing numerous guides about confiugring tomcat's memory, I realized I am seriously confused.  I attempted to configure the heap memory by adding setenv.sh file to the /opt/apache-tomcat-6.0.32/bin folder.  Here is the content of setenv.sh file.
      export CATALINA_OPTS="-Xms768m -Xmx768m"

asked by chill

question

You are on the right track.

You have...

 - created "bin/setenv.sh"
 - exported the CATALINA_OPTS environment variable
 - added the settings to configure the initial and max heap values to 768m

You just need to...

  - add -XX:PermSize and -XX:MaxPermSize to CATALINA_OPTS to configure PermGen to be 512M.
  - add -XX:NewSize and -XX:MaxNewSize to CATALINA_OPTS to configure YoungGen to be 200M.
  - restart your Tomcat instance

One note, unless you really, really know what you are doing I wouldn't recommend explicitly configuring the size of the YoungGen space.  The JVM does a great job of sizing this automatically.  Unless you have done some serious load testing on your application or you have been given exact instructions by a 3td party vendor, I would suggest just using the defaults.

Lastly, there are a couple ways that you can confirm that your settings are working.

1.) Run "ps aux | grep catalina" (or some other version of the "ps" command).  Look at your Tomcat process.  You should see all of the options that you've put into CATALINA_OPTS (and many more) included on the command line for your process.  If you see them listed here then they are active.

2.) Connect to Tomcat with "jconsole", click the "VM Summary" tab and look at the "VM arguments" section.  Again, you should see the options that you added to CATALINA_OPTS listed here.

3.) Run "jinfo <tomcat-pid>".  The last thing it prints will be the VM Flags.  These should include the options that you've specified in CATALINA_OPTS.


Lastly, I would suggest that you read these two articles.  This is more than just a shameless plug for my posts smiley.  They were written to gently introduce people to the concepts of JVM tuning (for Tomcat).  Furthermore, when you feel that you understand the topics presented in the article, you can progress along to the more advanced articles in the links.  This gentle progression should help take some of the confusion out of JVM tuning.

  http://www.tomcatexpert.com/blog/2011/11/16/setting-measurement-garbage-collection-apache-tomcat
  http://www.tomcatexpert.com/blog/2011/11/22/performance-tuning-jvm-running-tomcat

Hope that helps!

answered by dmikusa on January 10, 2012 07:32 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Operations | memory

Blog : Apache Valve Catalog

posted by chanthing on December 21, 2011 05:48 AM

1. Introduction

My last article for Tomcat Expert described various aspects of the Valve construct of Apache Tomcat: some basics about how to implement and configure a valve and an example of where things could go wrong if you were unaware of the operational details. For those of you who don’t remember (or didn’t read the article in the first place), the key takeaway was that because Tomcat valves are maintained as a chain, the order in which the valves are added to the configuration (typically in conf/server.xml) is significant, and the code that implements the filter must conclude with a call to invoke the next filter in the chain.

This time we’re going to lighten things up a bit with a general survey of what valves are available and how one might put them to use. Given the imminent arrival of the winter holiday season, one might think of it as the Apache Tomcat Valve Gift Catalog. Peruse it and find just the right gift for your favorite Tomcat administrator.

For each valve, I’ll describe its functionality, the most important configuration parameters, and point out any configuration subtleties that might not be apparent from the stock documentation. that can be found at http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html. If there are any less well-known attributes or “secret” parameters associated with the valve, I’ll describe them.

 

2. Request Logging

2.1 Access Log Valve

The AccessLogValve can be configured at the context, host, or engine level and will log requests made to that container to a file. Attributes of AccessLogValve control the directory, the filename, and the format of the data to be written, including the ability to write information about headers (incoming and outgoing), cookies, and session or request attributes.

Read More

0 comments   |  

0
Rating
  |  

Developers, Operations | Tomcat Configuration, Tomcat Performance, Tomcat Valves

Blog : Apache Tomcat 6.0.35 Released

posted by Stacey Schneider on December 6, 2011 12:09 PM

The Apache Tomcat team announces the immediate availability of Apache Tomcat 6.0.35 stable.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Apache Tomcat 6.0.35 is primarily a security and bug fix release. All users of older versions of the Tomcat 6.0 family should upgrade to 6.0.35.

Note that is version has 4 zip binaries: a generic one and three bundled with Tomcat native binaries for different CPU architectures.

Read More

2 comments   |  

0
Rating
  |  

Developers, Operations | Apache Tomcat 6

Ask the Experts : How to create/modify global connection pool on the fly?

Is it possible to create and modify global connection pool on the fly?

I want do be able to deploy new applications using new global connection pool without restart tomcat. I don't want to use context.xml file in my applications.

The article http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency shows how to create global connection pool configuring conf/server.xml file, but I don't know how to reflect change without restarting tomcat.

asked by persapiens

question

Is it possible to create new resources (as in <GlobalNamingResources><Resource .../></GlobalNamingResources>) at runtime?  No.  To create new global resources you need to modify "conf/server.xml" and restart Tomcat.

Is it possible to modify existing global resources?  It depends.  Some resources expose properties via JMX and those properties can be modified through jconsole.  If your resource exposes the properties that you need to modify then you should be able to update them at runtime.

Typically, when you need to be able to modify a resource without restarting Tomcat you would define that in your Context.  That way you can make changes to the Context, redeploy your application and see the changes all without restarting Tomcat.

answered by dmikusa on January 20, 2012 05:05 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Operations | global connection pool fly runtime

Blog : Apache Tomcat 7.0.23 Release

posted by Stacey Schneider on November 27, 2011 12:08 PM

The Apache Tomcat team announces the immediate availability of Apache Tomcat 7.0.23

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This release includes numerous bug fixes and several new features compared to version 7.0.22. The notable new features include:

  • The ability to start and stop child containers (primarily Contexts: i.e. web applications) in parallel which can significantly improve start times. This is disabled by default but can be enabled by setting the startStopThreads attribute of a Host to a value greater than one.
  • Cache the results of parsing the global and host level context.xml files to improve start times.
  • Improve the handling of failed deployments so that a broken application can be fixed (e.g. via JMX) and another attempt made to start it rather than it having to be removed.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-7.0-doc/changelog.html

Read More

0 comments   |  

0
Rating
  |  

Developers, Operations | Apache Tomcat 7

Blog : Performance Tuning the JVM for Running Apache Tomcat

posted by dmikusa on November 22, 2011 09:13 AM

This article is the second in a series discussing how to performance tune the JVM to better run Apache Tomcat. In the first article, we discussed the basic basic goals and how to monitor the performance of your JVM.

If you have not read the first article, I would strongly suggest reading that before continuing with this article. It is important to understand and follow the processes outlined in that article when performance tuning. They will both save you time and prevent you getting into trouble. With that, let's continue.

Tuning the JVM

At this point we've covered the basics and are ready to begin examining the JVM options that are available to us. Please note that while these options can be used for any application running on the JVM, this article will focus sole only how they can be applied to Tomcat. The usage of these options for other applications may or may not be appropriate.

Note: For simplicity, it is assumed that you are running an Oracle Hotspot JVM.

Read More

2 comments   |  

0
Rating
  |  

Developers, Operations | Tomcat Configuration, Tomcat Performance

Syndicate content