This repository has been archived by the owner on Oct 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GIRAPH-1033: Remove zookeeper from input splits handling
Summary: Currently we use zookeeper for handling input splits, by having each worker checking each split, and when a lot of splits are used this becomes very slow. We should have master coordinate input splits allocation instead, making the complexity proportional to #splits instead of #workers*#splits. Master holds all the splits and worker send requests to him asking for splits when they need them. Test Plan: Run a job with 200 machines and 200k small splits - without this change input superstep takes 30 minutes, and with it less than 2 minutes. Also verified correctness on sample job. mvn clean verify passes. Differential Revision: https://reviews.facebook.net/D48531
- Loading branch information
Maja Kabiljo
committed
Oct 19, 2015
1 parent
47da751
commit 5b0cd0e
Showing
41 changed files
with
1,164 additions
and
1,648 deletions.
There are no files selected for viewing
334 changes: 43 additions & 291 deletions
334
giraph-core/src/main/java/org/apache/giraph/bsp/BspService.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
giraph-core/src/main/java/org/apache/giraph/comm/requests/AskForInputSplitRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,76 @@ | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you under the Apache License, Version 2.0 (the | |||
* "License"); you may not use this file except in compliance | |||
* with the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.apache.giraph.comm.requests; | |||
|
|||
import org.apache.giraph.master.MasterGlobalCommHandler; | |||
import org.apache.giraph.io.InputType; | |||
|
|||
import java.io.DataInput; | |||
import java.io.DataOutput; | |||
import java.io.IOException; | |||
|
|||
/** | |||
* A request which workers will send to master to ask it to give them splits | |||
*/ | |||
public class AskForInputSplitRequest extends WritableRequest | |||
implements MasterRequest { | |||
/** Type of split we are requesting */ | |||
private InputType splitType; | |||
/** Task id of worker which requested the split */ | |||
private int workerTaskId; | |||
|
|||
/** | |||
* Constructor | |||
* | |||
* @param splitType Type of split we are requesting | |||
* @param workerTaskId Task id of worker which requested the split | |||
*/ | |||
public AskForInputSplitRequest(InputType splitType, int workerTaskId) { | |||
this.splitType = splitType; | |||
this.workerTaskId = workerTaskId; | |||
} | |||
|
|||
/** | |||
* Constructor used for reflection only | |||
*/ | |||
public AskForInputSplitRequest() { | |||
} | |||
|
|||
@Override | |||
public void doRequest(MasterGlobalCommHandler commHandler) { | |||
commHandler.getInputSplitsHandler().sendSplitTo(splitType, workerTaskId); | |||
} | |||
|
|||
@Override | |||
void readFieldsRequest(DataInput in) throws IOException { | |||
splitType = InputType.values()[in.readInt()]; | |||
workerTaskId = in.readInt(); | |||
} | |||
|
|||
@Override | |||
void writeRequest(DataOutput out) throws IOException { | |||
out.writeInt(splitType.ordinal()); | |||
out.writeInt(workerTaskId); | |||
} | |||
|
|||
@Override | |||
public RequestType getType() { | |||
return RequestType.ASK_FOR_INPUT_SPLIT_REQUEST; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
giraph-core/src/main/java/org/apache/giraph/comm/requests/ReplyWithInputSplitRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,81 @@ | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you under the Apache License, Version 2.0 (the | |||
* "License"); you may not use this file except in compliance | |||
* with the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.apache.giraph.comm.requests; | |||
|
|||
import org.apache.giraph.comm.ServerData; | |||
import org.apache.giraph.io.InputType; | |||
|
|||
import java.io.DataInput; | |||
import java.io.DataOutput; | |||
import java.io.IOException; | |||
|
|||
/** | |||
* A request which master will send to workers to give them splits | |||
*/ | |||
public class ReplyWithInputSplitRequest extends WritableRequest | |||
implements WorkerRequest { | |||
/** Type of input split */ | |||
private InputType splitType; | |||
/** Serialized input split */ | |||
private byte[] serializedInputSplit; | |||
|
|||
/** | |||
* Constructor | |||
* | |||
* @param splitType Type of input split | |||
* @param serializedInputSplit Serialized input split | |||
*/ | |||
public ReplyWithInputSplitRequest(InputType splitType, | |||
byte[] serializedInputSplit) { | |||
this.splitType = splitType; | |||
this.serializedInputSplit = serializedInputSplit; | |||
} | |||
|
|||
/** | |||
* Constructor used for reflection only | |||
*/ | |||
public ReplyWithInputSplitRequest() { | |||
} | |||
|
|||
@Override | |||
void readFieldsRequest(DataInput in) throws IOException { | |||
splitType = InputType.values()[in.readInt()]; | |||
int size = in.readInt(); | |||
serializedInputSplit = new byte[size]; | |||
in.readFully(serializedInputSplit); | |||
} | |||
|
|||
@Override | |||
void writeRequest(DataOutput out) throws IOException { | |||
out.writeInt(splitType.ordinal()); | |||
out.writeInt(serializedInputSplit.length); | |||
out.write(serializedInputSplit); | |||
} | |||
|
|||
@Override | |||
public void doRequest(ServerData serverData) { | |||
serverData.getServiceWorker().getInputSplitsHandler().receivedInputSplit( | |||
splitType, serializedInputSplit); | |||
} | |||
|
|||
@Override | |||
public RequestType getType() { | |||
return RequestType.REPLY_WITH_INPUT_SPLIT_REQUEST; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.