[opencms-dev] OpenCms 7.0.5 crashes with high load

Shi Yusen shiys at langhua.cn
Tue Mar 31 16:43:05 CEST 2009


I guess you missed our other modifications in CmsObject and
CmsResourceFilter to make the new script as powerful as we expected :).

<%@page buffer="none" session="false" 
		import="java.util.*, 
			java.lang.*,
			java.text.*,
			org.opencms.util.*,
			org.opencms.jsp.*,
			org.opencms.file.*,
			org.opencms.lock.*,
			org.opencms.main.*,
			org.opencms.frontend.templateone.*" %><%

CmsTemplateBean cms = new CmsTemplateBean(pageContext, request, response);
String filename = cms.getRequestContext().getUri();
String folder = cms.getRequestContext().getFolderUri();
String title = cms.property("Title", folder);
CmsResourceFilter filter = CmsResourceFilter.ALL;

// a new filter extended by Langhua
filter = filter.addTopLatest(10);

long t1 = System.currentTimeMillis();
List resources = cms.getCmsObject().readResources("/sites/default/", filter, true);
long t2 = System.currentTimeMillis();
%>
<table width="760">
        <tr>
	  <td>Get <%= resources.size() %> top latest resources.</td>
        </tr>
<%
for (int i=0; i< resources.size(); i++) {
%>
	<tr>
	  <td><%= ((CmsResource) resources.get(i)).getRootPath() %></td>
	</tr>
<%
}
%>
        <tr>
	  <td>Time spent: <%= (t2-t1)/1000.0 %> seconds.</td>
        </tr>
<%
// filter = filter.addRequireType(OpenCms.getResourceManager().getResourceType("news").getTypeId());
for (int i=0; i<10; i++) {
filter = filter.addPagedLatest(30*i, 30);
t1 = System.currentTimeMillis();
resources = cms.getCmsObject().readResources("/sites/default/", filter, true);
int total = cms.getCmsObject().countResources("/sites/default/", filter, true);
t2 = System.currentTimeMillis();
%>
	<tr>
	  <td>Get <%= resources.size() %> resources start from row <%= filter.getStartRow() %> of <%= total %>.</td>
        </tr>
        <tr>
	  <td>Time spent: <%= (t2-t1)/1000.0 %> seconds.</td>
        </tr>
<%
}
%>
<table>

Good luck,

Shi Yusen/Beijing Langhua Ltd.

在 2009-03-31二的 16:20 +0200,Nacho Fernández Orellana写道:
>  Thank you all for your clever insights.
> 
> I think I understood correctly the problem because my line of thoughts
> was somehow similar to yours. I would have loved the Alkacon guys
> giving their expert opinion, but nevertheless the information is top
> quality.
> 
> We tried Shi Yusen modifications on the code (the ones that closes
> much more all conections opened), and oddly the guys making the tests
> noticed no improvements when the pool is in "blocked" mode and max
> connections are high to 50-100.
> 
> Now we are working on the line of static exports and better flex
> cache. If we develop something original and useful to the community,
> needless is to say we will contribute it. Thanks again. Greetings,
> 
> Nacho Fernandez.
> _______________________________________________
> 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
> http://lists.opencms.org/mailman/listinfo/opencms-dev




More information about the opencms-dev mailing list