File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Increase JVM Heap size in Tomcat 6.0

 
Vijay Kumar Raman
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Sumit Patil
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hope this will help.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17645
39
Android Eclipse IDE Linux
  • 1
  • Mark post as helpful
  • send pies
  • 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: 12
  • 0
  • Mark post as helpful
  • send pies
  • 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
Pie
Posts: 17645
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the clarification. I will post my query in hibernate OR mapping forum.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic