
Why?
My web application consumes a lot of memory, basically because a large portion of the backend database is cached into memory (for performance reasons). The web app consumes around 700MB when no users are logged in, but can climb to 1.5GB when admins are using it. Some memory intensive admin functions can take the system down, i.e. OutOfmemory exceptions. I was never able to allocate more than 1.5GB to the JVM (Tomcat simply refuses to start when I try to go higher, probably because Windows refuses to allocate the requested memory). After reading some Microsoft papers I concluded that this was related to the maximum amount of memory a 32-bit Windows application can access: 4GB total of which 2GB are reserved for the system (to hold network buffers, etc.) and 2GB are accessible to the application. You can tweak the system to move an extra 1GB from the system part to the user part (=> 1GB system, 3GB user) but this is not advisable for a web application because it is network intensive so you do not want to lower your network buffers. The solution to get rid of the 4GB limit is to move to a 64-bit system. I happened to have an spare Itanium server just sitting there, so there I go...
How?
- Install a 64-bit version of J2SE 1.4. For example:
C:\>java -version
java version "1.4.2_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_16-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.4.2_16-b05, mixed mode) - Install the latest Tomcat 4.1 release (4.1.37) using the Windows installer (apache-tomcat-4.1.37.exe). Check the option to install the windows service.
- After installation, the Tomcat service does not start.
Some error message like '%1 is not a valid 32bit application'. Probably because we are trying to run Tomcat as a 32-bit service using a 64bit JVM... - Read this very helpful post which explains how to run Tomcat as a 64-bit service.
The author is using a more modern stack than me (Tomcat 6 and Java6), but he explains he used a tomcat5.exe and just renamed it to tomcat6.exe. I thought I might use the same trick... - Move the files tomcat4.exe and tomcat4w.exe from your Tomcat installation to some other place (just to keep them handy if something goes wrong).
- Download the latest version of the Tomcat6 service (tomcat6.exe and tomcat6w.exe) from the Tomcat SVN repository. Copy them to the 'bin' directory of your Tomcat 4.1 installation, and rename the files to tomcat4.exe and tomcat4w.exe respectively.
- Start tomcat4w.exe. The Tomcat configuration window should pop-up, but you might have lost part of the configuration (I did). If the configuration is damaged, just re-create it manually. See screenshots.
- Start the Tomcat service.
Hope it works for you, it does for me.
Humbly yours,
Luca
1 comment:
2014 ...
And I still urgently looking to migrate my customer using Tomcat4 in 32-bits to a 64-bit JVM.
We are therefore 6 years later and it still proved useful
Post a Comment