Skip to content

[#825][part-2] feat(spark): Report failed blocks and a list of ShuffleServer - #1138

Merged
roryqi merged 1 commit into
apache:masterfrom
yl09099:uniffle-825-2
Oct 20, 2023
Merged

[#825][part-2] feat(spark): Report failed blocks and a list of ShuffleServer#1138
roryqi merged 1 commit into
apache:masterfrom
yl09099:uniffle-825-2

Conversation

@yl09099

@yl09099 yl09099 commented Aug 12, 2023

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

The ShuffleServer corresponding to the block that failed to be sent needs to be reported.

Ⅰ. Overall objective:

  1. During the shuffle write phase, the ShuffleServer reports faulty nodes and reallocates the ShuffleServer list;
  2. Triggers a Stage level retry of SPARK. The shuffleServer node is excluded and reallocated before the retry.

Ⅱ. Implementation logic diagram:

image

Ⅲ. As shown in the picture above:

  1. During Shuffle registration, obtain the ShuffleServer list to be written through the RPC interface of a Coordinator Client by following the solid blue line step. The list is bound using ShuffleID.
    2, the Task of Stage starts, solid steps, in accordance with the green by ShuffleManager Client RPC interface gets to be written for shuffleIdToShuffleHandleInfo ShuffleServer list;
  2. In the Stage, if Task fails to write blocks to the ShuffleServer, press the steps in red to report ShuffleServer to FailedShuffleServerList in RSSShuffleManager through the RPC interface.
  3. FailedShuffleServerList records the number of ShuffleServer failures. After the number of failures reaches the maximum number of retries of the Task level, follow the steps in dotted orange lines. Through the RPC interface of a Coordinator Client, obtain the list of ShuffleServer files to be written (the ShuffleServer files that fail to be written are excluded). After obtaining the list, go to Step 5 of the dotted orange line. Throwing a FetchFailed Exception triggers a stage-level retry for SPARK;
  4. Attempt 1 is generated by the SPARK Stage level again. Pull the corresponding ShuffleServer list according to the green dotted line.

Why are the changes needed?

Reports the ShuffleServer corresponding to the block that failed to be sent

Fix: #825

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing UT

@roryqi
roryqi requested a review from advancedxy August 12, 2023 17:08
@codecov-commenter

codecov-commenter commented Aug 12, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1138 (0500a29) into master (98b0d12) will increase coverage by 0.02%.
Report is 2 commits behind head on master.
The diff coverage is 42.10%.

@@             Coverage Diff              @@
##             master    #1138      +/-   ##
============================================
+ Coverage     54.55%   54.58%   +0.02%     
  Complexity     2613     2613              
============================================
  Files           375      375              
  Lines         20224    20307      +83     
  Branches       1930     1932       +2     
============================================
+ Hits          11033    11084      +51     
- Misses         8526     8554      +28     
- Partials        665      669       +4     
Files Coverage Δ
...uniffle/client/response/SendShuffleDataResult.java 46.15% <57.14%> (-37.18%) ⬇️
...va/org/apache/spark/shuffle/writer/DataPusher.java 62.26% <44.44%> (-3.65%) ⬇️
...he/uniffle/client/impl/ShuffleWriteClientImpl.java 33.97% <36.36%> (-1.82%) ⬇️

... and 4 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@yl09099
yl09099 force-pushed the uniffle-825-2 branch 4 times, most recently from bf311fa to 065a7ba Compare August 13, 2023 04:01
@roryqi roryqi changed the title [#825][part-2] feat:Report failed blocks and a list of ShuffleServer [#825][part-2] feat(spark): Report failed blocks and a list of ShuffleServer Aug 13, 2023
@yl09099 yl09099 closed this Oct 9, 2023
@yl09099 yl09099 reopened this Oct 9, 2023
@yl09099 yl09099 closed this Oct 9, 2023
@yl09099 yl09099 reopened this Oct 9, 2023
return;
}
taskToFailedBlockIdsAndServer
.computeIfAbsent(taskAttemptId, x -> Maps.newConcurrentMap())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaUtils.newConcurrentMap()?

public Map<Long, List<ShuffleServerInfo>> getFailedBlockIdsWithShuffleServer(String taskId) {
Map<Long, List<ShuffleServerInfo>> result = taskToFailedBlockIdsAndServer.get(taskId);
if (result == null) {
result = Maps.newHashMap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaUtils.newConcurrentMap?

// if send block failed, the task will fail
// todo: better to have fallback solution when send to multiple servers
/** Records the ShuffleServer that successfully or failed to send blocks */
Map<Long, List<ShuffleServerInfo>> blockIdSendSuccessTracker = Maps.newConcurrentMap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaUtils.newConcurrentMap?

@yl09099
yl09099 force-pushed the uniffle-825-2 branch 4 times, most recently from 6fdbd28 to 406c285 Compare October 9, 2023 06:47
@roryqi
roryqi requested a review from leixm October 9, 2023 10:38
@roryqi

roryqi commented Oct 9, 2023

Copy link
Copy Markdown
Contributor

@leixm Could you help me review this pr?

.addAll(blockIds);
}

private synchronized void putBlockIdAndShuffle(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Could we give this method a better name? I can't get the point of put shuffle.
  2. Will it influence the performance of pusher if we use the lock here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Could we give this method a better name? I can't get the point of put shuffle.
  2. Will it influence the performance of pusher if we use the lock here?
  1. The name has been changed.
  2. The lock here is the same logic as the putBlockId method above and should not affect it.

@yl09099
yl09099 force-pushed the uniffle-825-2 branch 2 times, most recently from cf24af4 to 0500a29 Compare October 11, 2023 06:17

@roryqi roryqi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let @leixm take an another look.

@advancedxy advancedxy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally lgtm, except one minor comment.

Comment on lines +386 to +387
return new SendShuffleDataResult(
Sets.newHashSet(2L), Sets.newHashSet(1L), Maps.newHashMap());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this line is needed? Since the constructor of SentShuffleDataResult is kept for compatibility.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this line is needed? Since the constructor of SentShuffleDataResult is kept for compatibility.

Have been modified.

successBlockIds.add(blockInfo.getBlockId());
}
return new SendShuffleDataResult(successBlockIds, Sets.newHashSet());
return new SendShuffleDataResult(successBlockIds, Sets.newHashSet(), Maps.newHashMap());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

* @param taskId Shuffle taskId
* @return List of failed ShuffleServer blocks
*/
public Map<Long, List<ShuffleServerInfo>> getFailedBlockIdsWithShuffleServer(String taskId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when is this method called?

And it seems a bit unusual to return an empty map without putting it back to the taskToFailedBlockIdsAndServer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when is this method called?

And it seems a bit unusual to return an empty map without putting it back to the taskToFailedBlockIdsAndServer.

Later PR will call this method.

// todo: better to have fallback solution when send to multiple servers
/** Records the ShuffleServer that successfully or failed to send blocks */
Map<Long, List<ShuffleServerInfo>> blockIdSendSuccessTracker = JavaUtils.newConcurrentMap();
Map<Long, List<ShuffleServerInfo>> blockIdsSendFailTracker = JavaUtils.newConcurrentMap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder: let's review the memory usage for this change after all the code has been finished.

I'm a bit of worried about the memory overhead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems not. The ShuffleServerInfo object in the map is reused.

@leixm

leixm commented Oct 16, 2023

Copy link
Copy Markdown
Contributor

+1 LGTM.

leixm
leixm previously approved these changes Oct 16, 2023

@roryqi roryqi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @advancedxy @yl09099 @leixm

@roryqi
roryqi merged commit 748acbf into apache:master Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Umbrella] Dynamic shuffle server assignment

5 participants