/* * (c) Copyright 2011 Epimorphics Ltd. * All rights reserved. * [See end of file] */ package reports; //package com.ibm.lld.test; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import org.openjena.atlas.lib.FileOps ; import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.shared.Lock; import com.hp.hpl.jena.sparql.util.Timer ; import com.hp.hpl.jena.tdb.TDB; import com.hp.hpl.jena.tdb.TDBFactory; import com.hp.hpl.jena.tdb.base.block.FileMode ; import com.hp.hpl.jena.tdb.sys.SystemTDB ; //public class TDBOutOfMemoryTest public class ReportOutOfMemoryManyGraphsTDB { //public static final String TDB_DIR = "D:/work/relm/outofmem_jena_DB"; public static final String TDB_DIR = "DB1"; public static final int NOGRAPHS = 100000; // Number of data graphs to load public static void main( String[] args ) { if ( false ) { // Set the TDB properties file. System.setProperty("com.hp.hpl.jena.tdb.settings", "tdb.properties") ; System.out.printf("Block read cache = %d\n", SystemTDB.BlockReadCacheSize) ; System.out.printf("Block write cache = %d\n", SystemTDB.BlockWriteCacheSize) ; System.out.printf("Node -> NodeId cache = %d\n", SystemTDB.Node2NodeIdCacheSize) ; System.out.printf("NodeId -> Node cache = %d\n", SystemTDB.NodeId2NodeCacheSize) ; } System.out.printf("Max mem: %,dM\n", (Runtime.getRuntime().maxMemory()/(1024*1024))) ; if ( true ) { System.out.println("DIRECT mode") ; SystemTDB.setFileMode(FileMode.direct) ; } FileOps.clearDirectory(TDB_DIR) ; System.out.println("> Starting test: " + new java.util.Date()); Timer timer = new Timer() ; timer.startTimer() ; Dataset dataset = TDBFactory.createDataset(TDB_DIR); System.out.println("> Initial number of indexed graphs: " + dataset.asDatasetGraph().size()); try { for (int i=0; i Done at: " + new java.util.Date()); long x = timer.endTimer() ; System.out.printf("%,d graphs in %,.2f sec\n", NOGRAPHS, (x/1000.0)) ; } catch (IOException e) { System.out.println("> Failed: " + e.getMessage()); } } private static InputStream getGraph(int no) { String graph = GRAPH_TEMPLATE.replaceAll("%NUMBER%", String.valueOf(no)); return new ByteArrayInputStream(graph.getBytes()); } private static final String GRAPH_TEMPLATE = " \n" + " \n" + " @mandrew\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " Process REST Service doesn't scale\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " false\n" + " \n" + " \n" + " \n" + " \n" + " 2011-02-23T22:33:45.764Z\n" + " _Q2fMII8EEd2Q-OW8dr3S5w\n" + " \n" + " \n" + " false\n" + " \n" + " \n" + " false\n" + " In Progress\n" + " Defect\n" + " \n" + " 2011-02-22T22:35:15.682Z\n" + " \n" + " false\n" + " Defect %NUMBER%\n" + " \n" + " \n" + " %NUMBER%\n" + " On Jazz.net, we have a 3.0 &quot;sandbox&quot; deployed (CCM+JTS) which allows any jazz.net user to create a project to try out RTC.&nbsp; We're seeing massive performance problems due to an apparent scalability problem in process.&nbsp; Currently, the sandbox has &gt; 100 projects created. This is causing the following issues:<br></br><br></br>1) Sandbox home page loads a list of the current user's projects by calling process rest service with user id.&nbsp; This request takes &gt; 60 seconds.<br></br>2) CCM app gets stuck on &quot;Loading...&quot; for &gt; 60 seconds, spinning on the request to InitializationData.&nbsp; InitData is waiting to get the response from process's initializer (which is doing a lookup based on the name of the project).<br></br>3) Home menu hangs for a long time waiting for the list of projects to populate (There's also a UI scaleability issue in the home menu... the number of projects exceeds available space in the viewport, but that's another item).<br></br><br></br>This is a blocker. Process must be able to scale to hundreds, possibly thousands of projects, without slowing down the loading of the web UI.\n" + " \n" + " \n" + " service\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " false\n" + " false\n" + " \n" + " \n" + " true\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " https://jazz.net/sandbox02/ccm/service/com.ibm.team.process.internal.common.service.IProcessRestService/processAreasForUser?userId=shilpat\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " @packham\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " 154737: Replace ProjectAreaWebUIInitializionData with a dynamic module\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " @retchles\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " Changes in Process - <No Comment> - Jared Burns - Feb 23, 2011 1:36 AM\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " @mjarvis\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " Changes in Process - Performance test - Martha Andrews - Feb 22, 2011 9:45 PM\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " @storaskar\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#Project_Areas_collection\n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n"; } /* * (c) Copyright 2011 Epimorphics Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */