kumarvishal09 commented on a change in pull request #3281: [WIP]Index server 
performance improvement
URL: https://github.com/apache/carbondata/pull/3281#discussion_r295205673
 
 

 ##########
 File path: 
core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapper.java
 ##########
 @@ -0,0 +1,240 @@
+/*
+ * 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.carbondata.core.indexstore;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.datastore.compression.SnappyCompressor;
+import org.apache.carbondata.core.datastore.filesystem.CarbonFile;
+import org.apache.carbondata.core.datastore.impl.FileFactory;
+import org.apache.carbondata.core.metadata.schema.table.Writable;
+import org.apache.carbondata.core.stream.ExtendedByteArrayInputStream;
+import org.apache.carbondata.core.stream.ExtendedByteArrayOutputStream;
+import org.apache.carbondata.core.stream.ExtendedDataInputStream;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.core.util.CarbonUtil;
+
+import org.apache.log4j.Logger;
+
+/**
+ * class will be used to send extended blocklet object from index executor to 
index driver
+ * if data size is more than it will be written in temp folder provided by user
+ * and only file name will send, if data size is less then complete data will 
be send to
+ * index executor
+ */
+public class ExtendedBlockletWrapper implements Writable, Serializable {
+
+  private static final Logger LOGGER =
+      LogServiceFactory.getLogService(ExtendedBlockletWrapper.class.getName());
+
+  private boolean isWrittenToFile;
+
+  private int dataSize;
+
+  private byte[] bytes;
+
+  private static final int BUFFER_SIZE = 8 * 1024 * 1024;
+
+  private static final int BLOCK_SIZE = 256 * 1024 * 1024;
+
+  public ExtendedBlockletWrapper() {
+
+  }
+
+  public ExtendedBlockletWrapper(List<ExtendedBlocklet> extendedBlockletList, 
String tablePath,
+      String queryId) {
+    Map<String, Short> uniqueLocations = new HashMap<>();
+    byte[] bytes = convertToBytes(tablePath, uniqueLocations, 
extendedBlockletList);
+    int serializeAllowedSize = Integer.parseInt(CarbonProperties.getInstance()
+        
.getProperty(CarbonCommonConstants.CARBON_INDEX_SERVER_SERIALIZATION_THRESHOLD))
 * 1024;
+    DataOutputStream stream = null;
+    // if data size is more then data will be written in file and file name 
will be sent from
+    // executor to driver, in case of any failure data will send through 
network
+    if (bytes.length > serializeAllowedSize) {
 
 Review comment:
   @manishgupta88 
   Lets assume a scenario of 1000 executors, and each executor is processing  
700KB then 300 KB will be sent using serialization and remaining 400 will be 
written to file(threshold is 300KB). This will decrease the performance of 
index server driver as 300KB * 1000 = 300000KB/~293MB would be written to RPC 
network layer by the index driver. This may become a bottleneck as the data 
grows.
    
   We had thought of this approach but combining the output in driver would 
have led to major code change therefore we can pick it up later after further 
discussion and if we actually get any performance benefit from it. We will 
raise a optimization JIRA for this. 

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


With regards,
Apache Git Services

Reply via email to