[
https://issues.apache.org/jira/browse/GOBBLIN-706?focusedWorklogId=217367&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-217367
]
ASF GitHub Bot logged work on GOBBLIN-706:
------------------------------------------
Author: ASF GitHub Bot
Created on: 22/Mar/19 18:09
Start Date: 22/Mar/19 18:09
Worklog Time Spent: 10m
Work Description: ibuenros commented on pull request #2576:
[GOBBLIN-706]enable dynamic mappers
URL: https://github.com/apache/incubator-gobblin/pull/2576#discussion_r268283675
##########
File path:
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaSource.java
##########
@@ -258,10 +258,20 @@ public String apply(KafkaTopic topic) {
// Create empty WorkUnits for skipped partitions (i.e., partitions that
have previous offsets,
// but aren't processed).
createEmptyWorkUnitsForSkippedPartitions(workUnits,
topicSpecificStateMap, state);
-
- int numOfMultiWorkunits =
+ //determine the number of mappers
+ int maxMapperNum =
state.getPropAsInt(ConfigurationKeys.MR_JOB_MAX_MAPPERS_KEY,
ConfigurationKeys.DEFAULT_MR_JOB_MAX_MAPPERS);
- List<WorkUnit> workUnitList = KafkaWorkUnitPacker.getInstance(this,
state).pack(workUnits, numOfMultiWorkunits);
+ KafkaWorkUnitPacker kafkaWorkUnitPacker =
KafkaWorkUnitPacker.getInstance(this, state);
+ int numOfMultiWorkunits = maxMapperNum;
+ if(state.contains(ConfigurationKeys.MR_TARGET_MAPPER_SIZE)) {
+ double totalEstDataSize =
kafkaWorkUnitPacker.getWorkUnitEstSizes(workUnits);
+ LOG.info(String.format("The total estimated data size is %.2f",
totalEstDataSize));
+ double targetMapperSize =
state.getPropAsDouble(ConfigurationKeys.MR_TARGET_MAPPER_SIZE);
+ numOfMultiWorkunits = (int) (totalEstDataSize / targetMapperSize);
+ numOfMultiWorkunits = numOfMultiWorkunits>maxMapperNum?
maxMapperNum:numOfMultiWorkunits;
+ numOfMultiWorkunits = numOfMultiWorkunits==0? 1: numOfMultiWorkunits;
Review comment:
You actually need to add 1 in general. Since integer division truncates
down, you always want to add 1. (e.g. total size is 1.99, but targetMapperSize
is 1, the current algorithm would use 1 mapper).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 217367)
Time Spent: 1h 20m (was: 1h 10m)
> Making KafkaSource dynamically determine the number of mapper
> -------------------------------------------------------------
>
> Key: GOBBLIN-706
> URL: https://issues.apache.org/jira/browse/GOBBLIN-706
> Project: Apache Gobblin
> Issue Type: Improvement
> Reporter: Lei Sun
> Priority: Major
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)