[opencms-dev] storing lots of data in opencms

Isaac R. Higgins isaac.higgins at isaacray.com
Wed Dec 5 18:13:35 CET 2007

As far as my experience knows, keeping a large amount of files is no problem for OpenCMS.  You can even create an index JSP file that lists all the PDFs in a particular folder for a simple list of the files.  The only issue I've ever run into is when the files exceed 15MB, they take a considerable amount of VM memory to go through the search indexing.  I have my VM set to 350MB and it can handle files at least 30MB.  If the search indexing runs out of VM memory the server will stop responding.

If they are MS files, like powerpoint and word, that have many images, make sure your users know how to compress the images in the file before uploading it to the server.  This generally isn't a problem with PDFs because most PDF generators use JPG compression on images by default.

I created a script that lets me search the VFS for large files so I can force the user who created it to reduce the file size or delete the file.
*Begin script
<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<jsp:useBean id="cmsbean" class="org.opencms.jsp.CmsJspBean">
  <% cmsbean.init(pageContext, request, response); %>

  long afterTime = (request.getParameter("maxDays")==null?(long)5000000:Long.parseLong(request.getParameter("maxDays").trim()));
  org.opencms.file.CmsObject cms = cmsbean.getCmsObject();
  org.opencms.file.CmsResourceFilter filter = org.opencms.file.CmsResourceFilter.ALL;
  java.util.List al = cms.readResources("/",filter);

<cms:include property="template" element="head" />
<form action="" method="GET">
How many minimum bytes would you like to specify? <input name="maxDays" type="text" id="maxDays" size="10" maxlength="10" value="<%=(request.getParameter("maxDays")==null?"5000000":request.getParameter("maxDays"))%>"/>
<input type="submit">
<br />
<table border=1 cellpadding=1 cellspacing=0 align="center" style="font-size:9px;">
  <th>Created By</th>
 for (int i=0;i<al.size();++i){
	org.opencms.file.CmsResource ress = null;
	long size = 0;
		ress = cms.readResource(cms.getSitePath((org.opencms.file.CmsResource)al.get(i)));
		size = ress.getLength();
	}catch(Exception e){}
	if (size>afterTime){
  <td style="font-size:9px;"><%= cms.getSitePath((org.opencms.file.CmsResource)al.get(i)) %></td>
  <td style="font-size:9px;"><%= addCommas(String.valueOf(size)) %></td>
  <td style="font-size:9px;"><%= cms.readUser(((org.opencms.file.CmsResource)al.get(i)).getUserLastModified()).getFullName() %></td>
  <td style="font-size:9px;"><%= cms.readUser(((org.opencms.file.CmsResource)al.get(i)).getUserCreated()).getFullName() %></td>
<cms:include property="template" element="foot" />

String addCommas(String usedS){
	String newNum = "";
       	int count = 0;
       	for (int i = usedS.length()-1; i>=0;--i){
		String oneChar = usedS.substring(i,i+1);
		if (count == 3){
			newNum += ",";
			newNum += oneChar;
			count = 1;
			newNum += oneChar;
	usedS = "";
	for (int i = newNum.length()-1; i >= 0; --i){
		String oneChar = newNum.substring(i,i+1);
		usedS += oneChar;
	return usedS;
*End script

-----Original Message-----
From: opencms-dev-bounces at opencms.org on behalf of Seth Lenzi
Sent: Wed 12/5/2007 12:02 PM
To: The OpenCms mailing list
Subject: [opencms-dev] storing lots of data in opencms
If one were to have a lot of binary files on their web  site (pdfs, 
docs, pictures, etc) is it ok to store all this in the OpenCMS VFS? 
 From a design perspective would this be exceptable? I'm not sure how 
well OpenCMS can cope with large amounts of data... would it be a better 
approach to store all this data outside of the OpenCMS system and 
somehow link to it from ones OpenCMS site?


This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4774 bytes
Desc: not available
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20071205/e9629702/attachment.bin>

More information about the opencms-dev mailing list