Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330984

Summary: Performance: persist and restore IDependencyGraph
Product: [WebTools] WTP Java EE Tools Reporter: Jason Sholl <jsholl>
Component: jst.j2eeAssignee: Jason Sholl <jsholl>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: melickm
Version: 3.2Flags: cbridgha: review+
jsholl: review? (ccc)
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows Server 2003   
Whiteboard:
Attachments:
Description Flags
patch none

Description Jason Sholl CLA 2010-11-23 20:55:43 EST
During workspace startup, especially with large workspaces containing numerous projects, the IDependencyGraph may be slow with its initial computation.  This slowness occurs because the IDependencyGraph is the first to force the load of each project's component model and is typically triggered when the EAR Libraries classpath container loads.  This bugzilla enables the IDependencyGraph to restore its state based on the state stored in a previous workspace session and significantly reduces startup time spent computing the IDependencyGraph.  Also, this completely eliminates blocked calls in DependencyGraphImpl.waitForAllUpdates() during startup which in the past has has been a significant deadlock risk (and still is, though not as much now, and will be even less with these changes).

In conjunction on the above change, I am also investigating adding similar save/restore support for the EAR Libraries and Web App Libraries classpath containers.  I will open a separate bugzilla for those changes when they are ready for review.  Together these changes will dramatically improve startup time.

The save is performed on a separate non blocking job which is reused such that if multiple changes are made consecutively, the file will only be saved once.  This job is scheduled from the notification job after all notifications have been fired, so this will not alter the timing of graph updates.

The restore is performed once at startup and several precautions have been made to avoid restoring a bad workspace.  First, if the file does not exist, or is corrupted in any way the restore aborts and the graph is computed from scratch.  Second, restore data is valid, first a quick check is made against the workspace to ensure all projects in the restore data are accessible; if any are not the restore aborts and the graph is computed from scratch.  Finally, if the first two check pass, then the graph is completely restored, and a job is scheduled to double check the results.  This job is scheduled immediately and ensures the restored graph is accurate; if any difference is observed, then the graph is recomputed from scratch.
Comment 1 Jason Sholl CLA 2010-11-23 20:57:20 EST
Created attachment 183721 [details]
patch
Comment 2 Chuck Bridgham CLA 2010-11-24 13:34:26 EST
tested - worked for me...    looks good
Comment 3 Jason Sholl CLA 2010-11-24 15:03:16 EST
Code checked into 32M and HEAD for WTP 3.2.3 and 3.3