Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330984 - Performance: persist and restore IDependencyGraph
Summary: Performance: persist and restore IDependencyGraph
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows Server 2003
: P3 normal (vote)
Target Milestone: 3.2.3   Edit
Assignee: Jason Sholl CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-23 20:55 EST by Jason Sholl CLA
Modified: 2010-12-08 13:20 EST (History)
1 user (show)

See Also:
cbridgha: review+
jsholl: review? (ccc)


Attachments
patch (13.46 KB, patch)
2010-11-23 20:57 EST, Jason Sholl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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