HolyLow commented on code in PR #3156:
URL: https://github.com/apache/celeborn/pull/3156#discussion_r2011187013


##########
cpp/celeborn/client/ShuffleClient.h:
##########
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "celeborn/client/reader/CelebornInputStream.h"
+#include "celeborn/network/NettyRpcEndpointRef.h"
+
+namespace celeborn {
+namespace client {
+class ShuffleClient {
+ public:
+  virtual void setupLifecycleManagerRef(std::string& host, int port) = 0;
+
+  virtual void setupLifecycleManagerRef(
+      std::shared_ptr<network::NettyRpcEndpointRef>& lifecycleManagerRef) = 0;
+
+  virtual void updateReducerFileGroup(int shuffleId) = 0;
+
+  virtual std::unique_ptr<CelebornInputStream> readPartition(
+      int shuffleId,
+      int partitionId,
+      int attemptNumber,
+      int startMapIndex,
+      int endMapIndex) = 0;
+
+  virtual bool cleanupShuffle(int shuffleId) = 0;
+
+  virtual void shutdown() = 0;
+};
+
+class ShuffleClientImpl : public ShuffleClient {

Review Comment:
   I don't really get it as currently the Java's getReducerFileGroup is issued 
once per request as long as the response is not buffered yet. There is no 
locking mechanism as the one in RegisterShuffle. Thus, the cpp's implementation 
exactly mimics this behavior.
   For cpp, although the ShuffleClient is not singleton, a ShuffleClient should 
still be reused by all the mappers/reducers of the same shuffle. So the 
getFileGroupResponse could be reused across different mappers/reducers of the 
same shuffle on the same executor process. 
   The ShuffleClient itself is a pool for all the meta info of a specific 
shuffle, and different shuffles could use different ShuffleClient instances. 
The mappers/reducers of a same shuffle should use a same ShuffleClient for 
metadata buffering. Besides, the different ShuffleClients could share the 
underlying resources including thread pool, memory pool, connection pool, etc.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to