• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Increase JVM Heap size in Tomcat 6.0

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need to increase JVM Heap size in Tomcat 6.0 to 100MB. I am running a web application in Tomcat6 using whcih I should upload and download file attachments of size upto 100MB.
I start Tomcat6 from the console mode. i.e, D:\Program Files\Apache Software Foundation\Tomcat 6.0\bin>tomcat6.exe.
I tried increasing heap size from command prompt by setting hte environment variables CATALINA_OPT and JAVA_OPT. it didnt help either. please help. Tomcat is not running as a windows service in my PC either.
 
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope this will help.
 
Saloon Keeper
Posts: 28076
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adding RAM to the JVM may not help. Typically files are uploaded to a temporary filesystem location and you are given access to the uploaded data without the need for the entirety of the uploaded data to ever exist simultaneously in RAM.

Likewise, when presenting large files to the client, it's more efficient to use a buffered data copy process than to load all the data to be downloaded into RAM and then copy the RAM to the HttpResponse outputstream.

However, as far as JVM tuning goes, you can define a JAVA_OPTS environment-setting statement and place it in a file named TOMCAT_HOME/bin/setenv.bat (setenv.sh for Linux/Unix).
 
Vijay Kumar Raman
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried modifiying the JAVA_OPT and CATALINA_OPT environment variable's values to 1GB but still getting the same exception "outofmemoryerror". I believe my current approach which reads the whole file from FileInputStream and stores it in a byte[] array and finally storing the byte[] array to the database is giving problem since it requires the whole file should be stored in memory before persisiting into database. Is there any approach in hibernate 3.0 to store large files in database and without ctoring them in memory (RAM).

I need alternative solution to modify my application code to handle large files rather than modifying the application server environment variables values since my application will be deployed in different application servers.

Thanks.
 
Tim Holloway
Saloon Keeper
Posts: 28076
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You wouldn't really want to store that much data in RAM, since it would basically only work for a very small number of users if it worked at all.

I think you can probably setup a mechanism whereby the cached incoming input is streamed directly into the Hibernate BLOB, but you're better off asking about that in the Hibernate forum. There would be no essential difference just because you were doing it in a webapp.
 
Vijay Kumar Raman
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the clarification. I will post my query in hibernate OR mapping forum.
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic