← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4668: Data mart, made the tasks running in parallell more evenly distributed in terms of workload, impr...

 

------------------------------------------------------------
revno: 4668
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-09-24 00:39:54 +0200
message:
  Data mart, made the tasks running in parallell more evenly distributed in terms of workload, improves performance as cpus are utilized better. Overall processing time down 18 %.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/WeightedPaginatedList.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java	2011-07-01 11:27:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java	2011-09-23 22:39:54 +0000
@@ -32,13 +32,14 @@
 import java.util.Date;
 
 import org.hisp.dhis.common.AbstractNameableObject;
+import org.hisp.dhis.common.Weighted;
 
 /**
  * @author Kristian Nordal
  * @version $Id: Period.java 5277 2008-05-27 15:48:42Z larshelg $
  */
 public class Period
-    extends AbstractNameableObject
+    extends AbstractNameableObject implements Weighted
 {
     /**
      * Determines if a de-serialized file is compatible with this class.
@@ -148,6 +149,12 @@
     {
         return periodType != null ? periodType.getFrequencyOrder() : YearlyPeriodType.FREQUENCY_ORDER;
     }
+    
+    @Override
+    public int getWeight()
+    {
+        return frequencyOrder() + 15;
+    }
 
     /**
      * Formats a Date to the format YYYY-MM-DD.

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2011-09-23 15:12:19 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2011-09-23 22:39:54 +0000
@@ -58,8 +58,8 @@
 import org.hisp.dhis.system.util.ConcurrentUtils;
 import org.hisp.dhis.system.util.ConversionUtils;
 import org.hisp.dhis.system.util.FilterUtils;
-import org.hisp.dhis.system.util.PaginatedList;
 import org.hisp.dhis.system.util.SystemUtils;
+import org.hisp.dhis.system.util.WeightedPaginatedList;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -266,7 +266,7 @@
 
         state.setMessage( "exporting_data_for_data_elements" );
 
-        List<List<Period>> periodPages = new PaginatedList<Period>( periods ).setNumberOfPages( cpuCores ).getPages();
+        List<List<Period>> periodPages = new WeightedPaginatedList<Period>( periods, cpuCores ).getPages();
         
         if ( allOperands.size() > 0 )
         {

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/WeightedPaginatedList.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/WeightedPaginatedList.java	2011-09-23 19:39:08 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/WeightedPaginatedList.java	2011-09-23 22:39:54 +0000
@@ -64,8 +64,6 @@
         }
         
         weightPageBreak = (int) Math.ceil( (double) totalWeight / pages );
-        
-        System.out.println( "tot " + totalWeight + " break " + weightPageBreak );
     }
     
     /**


Follow ups