commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Haverkamp (JIRA)" <>
Subject [jira] Created: (IO-220) FileCleaningTracker Vector performs badly under load
Date Fri, 23 Oct 2009 20:33:59 GMT
FileCleaningTracker Vector performs badly under load

                 Key: IO-220
             Project: Commons IO
          Issue Type: Bug
    Affects Versions: 1.4, 1.3.2, 1.3.1, 1.3, 1.2, 1.1, 1.0, 2.0, 2.x
         Environment: Using commons-io-1.4 via commons-fileupload-1.1.1 in Apache Tomcat/5.5.0
on Java 1.6.
            Reporter: Michael Haverkamp

When subjected to heavy load, the performance of
degrades and becomes a bottleneck to the system.  In our case, we had over 2 millions entries
on the "trackers" Vector.  Under these conditions, the call to trackers.remove(tracker) on
line 214 becomes very inefficient as it causes the Vector to shift and reindex the remaining
data.  In addition, calls to trackers.add are forced to wait on the inefficient remove operation.
 With the application idle, it took several hours for the File Reaper thread to finish processing
the entries on the trackers Vector.

The solution for use was to implement trackers as a HashSet instead of a Vector.  Thus line
52 was changed from:
    final Collection /* Tracker */ trackers = new Vector();  // synchronized
    final Collection /* Tracker */ trackers = Collections.synchronizedSet(new HashSet());
 // synchronized
Imports were also change appropriately.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message