チャンク パーティション ステップに読み込まれたレポートの膨大なリストがあります。各レポートはさらに処理され、個別のレポートが生成されます。しかし、パーティション ステップで 50k のレポートをロードすると、サーバーが過負荷になり、速度が大幅に低下します。その代わりに、パーティション ステップで 3k のレポート リストをロードし、それを処理してから、パーティション ステップで別の 3k レポートをロードします。50k レポートが処理されるまで同じことを続けます。
<step id="genReport" next="fileTransfer">
<chunk item-count="1000">
<reader ref="Reader" >
</reader>
<writer
ref="Writer" >
</writer>
</chunk>
<partition>
<mapper ref="Mapper">
<properties >
<property name="threadCount" value="#{jobProperties['threadCount']}"/>
<property name="threadNumber" value="#{partitionPlan['threadNumber']}"/>
</properties>
</mapper>
</partition>
</step>
public PartitionPlan mapPartitions() {
PartitionPlanImpl partitionPlan = new PartitionPlanImpl();
int numberOfPartitions = //dao call to load the reports count
partitionPlan.setThreads(getThreadCount());
partitionPlan.setPartitions(numberOfPartitions); //This numberOfPartitions is comes from the database, huge size like 20k to 40k
Properties[] props = new Properties[numberOfPartitions];
for (int idx = 0; idx < numberOfPartitions; idx++) {
Properties threadProperties = new Properties();
threadProperties.setProperty("threadNumber", idx + "");
GAHReportListData gahRptListData = gahReportListManager.getPageToProcess(); //Data pulled from PriorityBlockingQueue
String dynSqlId = gahRptListData.getDynSqlId();
threadProperties.setProperty("sqlId", dynSqlId);
threadProperties.setProperty("outFile", fileName);
props[idx] = threadProperties;
}
partitionPlan.setPartitionProperties(props);
return partitionPlan;
}
パーティション マッパーによって処理されたデータのレポートが 3k になると、次の使用可能なリストを確認する必要があります。使用可能な場合は、次の 3k レポートのセットを処理するためにパーティションをリセットする必要があります。