yaooqinn commented on a change in pull request #2057: URL: https://github.com/apache/incubator-kyuubi/pull/2057#discussion_r821510811
########## File path: docs/deployment/incremental_collection.md ########## @@ -0,0 +1,129 @@ +<!-- + - 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. + --> + +<div align=center> + + + +</div> + +# Solution for Big Result Set + +Normally, when user sumbits a SELECT query to Spark SQL engine, the Driver calls `collect` to trigger calculation and +retrieve all partitions from all Worker nodes, after all partitions data arrived, then Driver sends the data back to +client through Kyuubi Server streamingly in small batch, the batch size decided by `TFetchResultsReq.maxRows`. + +Therefore, for query has big result set, the bottleneck is the Spark Driver, to avoid OOM, Spark has a configuration +`spark.driver.maxResultSize` which default is `1g`, you should enlarge it as well as `spark.driver.memory` if your +query has result set in several GB. But what if the result set size is dozens GB or event hundreds GB? You need +incremental collection. + +## Incremental collection + +Since v1.4.0-incubating, Kyuubi supports incremental collect mode, it is a solution for big results set. This feature +is disabled in default, you can turn on it by setting the internal[1] configuration +`kyuubi.operation.incremental.collect` to `true`. + +Incremental collection changes the gather method from `collect` to `toLocalIterator`. `toLocalIterator` is a Spark +action which sequentially submit Jobs to retrieve partitions. As each partition is retrieved, the Driver sends it back +to the client through Kyuubi Server streamingly. It reduces the amount of heap memory required on the Driver – from Review comment: kindly reminder @pan3793 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
