Have you put the app under a profiler to see what components are taking the most time in each container? Seems like the best way to get some facts on the table.
On Sun, 2015-04-12 at 23:50 +0200, Øyvind Harboe wrote: > Hi, > > I'm having problems with performance degrading dramatically when I > deploy our application to a Tomcat container. The application uses > Apache Cayenne ORM on top of Derby. > > Does anyone have any pointers on how I can debug this to figure out > what I'm doing wrong? > > Generating a report which includes ca. 100 queries and thousands of > records takes less than one second on Jetty, but in the Tomcat > container it takes more than 10 seconds, so a 10x slowdown or so. > > I can't believe that Jetty is 10x faster than Tomcat. > > I've tried to figure out what the differences are between these two > environments without luck. > > Jetty and Tomcat are equal in terms of: > > - same VM options > - debug vs. non-debug mode > - tests run on same machine side-by-side > - same database files(copied to another location on the harddisk) > > Some differences: > > - Jetty is using org.apache.cayenne.conn.PoolManager rather than > Tomcat's connection pools. > > > When I suspend Tomcat in the debugger, the typical stack trace is > something about fetching pages: > > > BaseContainerHandle(Observable).addObserver(Observer) line: 82 > StoredPage(BasePage).preLatch(BaseContainerHandle) line: not available > StoredPage(BasePage).setExclusive(BaseContainerHandle) line: not available > RAFContainer4(BaseContainer).latchPage(BaseContainerHandle, BasePage, > boolean) line: not available > RAFContainer4(FileContainer).latchPage(BaseContainerHandle, BasePage, > boolean) line: not available > RAFContainer4(FileContainer).getUserPage(BaseContainerHandle, long, > boolean, boolean) line: not available > RAFContainer4(FileContainer).getPage(BaseContainerHandle, long, > boolean) line: not available > BaseContainerHandle.getPage(long) line: not available > OpenHeap(OpenConglomerate).latchPage(RowPosition) line: not available > HeapController(GenericConglomerateController).fetch(RowLocation, > DataValueDescriptor[], FormatableBitSet) line: not available > IndexRowToBaseRowResultSet.getNextRowCore() line: not available > ProjectRestrictResultSet.getNextRowCore() line: not available > NestedLoopJoinResultSet.getNextRowCore() line: not available > ProjectRestrictResultSet.getNextRowCore() line: not available > SortResultSet.getRowFromResultSet() line: not available > SortResultSet.getNextRowFromRS() line: not available > SortResultSet.loadSorter() line: not available > SortResultSet.openCore() line: not available > SortResultSet(BasicNoPutResultSetImpl).open() line: not available > GenericPreparedStatement.executeStmt(Activation, boolean, boolean, > long) line: not available > GenericPreparedStatement.execute(Activation, boolean, long) line: not > available > EmbedPreparedStatement(EmbedStatement).executeStatement(Activation, > boolean, boolean) line: not available > EmbedPreparedStatement.executeStatement(Activation, boolean, boolean) > line: not available > EmbedPreparedStatement.executeQuery() line: not available > SelectAction.performAction(Connection, OperationObserver) line: 75 > DataNodeQueryAction.runQuery(Connection, Query) line: 87 > >