You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/10/25 14:08:06 UTC

[GitHub] [incubator-kyuubi] CHzxp opened a new pull request, #3697: [KYUUBI #3695]

CHzxp opened a new pull request, #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697

   Why are the changes needed?
   As described in issues#3695:  Kyuubi pool-share-level current policies can not dynamic expand or decrease engin according to engin load
   
   How was this patch tested?
   Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   Add screenshots for manual tests if appropriate
   
   [Run test] locally before make a pull request
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on pull request #3697: [KYUUBI #3695]Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
CHzxp commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1291460245

   please review code


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030605015


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala:
##########
@@ -105,20 +107,28 @@ private[kyuubi] class EngineRef(
         warn(s"Request engine pool size($clientPoolSize) exceeds, fallback to " +
           s"system threshold $poolThreshold")
       }
-      val seqNum = enginePoolBalancePolicy match {
+      val finallySubdomain = enginePoolBalancePolicy match {
         case "POLLING" =>
           val snPath =
             DiscoveryPaths.makePath(
               s"${serverSpace}_${KYUUBI_VERSION}_${shareLevel}_$engineType",
               "seq_num",
               Array(appUser, clientPoolName))
-          DiscoveryClientProvider.withDiscoveryClient(conf) { client =>
+          val seqNum = DiscoveryClientProvider.withDiscoveryClient(conf) { client =>
             client.getAndIncrement(snPath)
           }
+          s"$clientPoolName-${seqNum % poolSize}"
         case "RANDOM" =>
-          Random.nextInt(poolSize)
+          s"$clientPoolName-${Random.nextInt(poolSize) % poolSize}"
+        case "REBALANCED" =>
+          val commonParent = s"${serverSpace}_${KYUUBI_VERSION}_${shareLevel}_$engineType"
+          RebalancedSparkEnginePolicy.getSuitableDomainSpace(

Review Comment:
   why not return a seqNum? then it is consistent w/ existing policies.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030552932


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala:
##########
@@ -105,20 +107,28 @@ private[kyuubi] class EngineRef(
         warn(s"Request engine pool size($clientPoolSize) exceeds, fallback to " +
           s"system threshold $poolThreshold")
       }
-      val seqNum = enginePoolBalancePolicy match {
+      val finallySubdomain = enginePoolBalancePolicy match {

Review Comment:
   "finallySubdomain" => "_subdomain"



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030547857


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -2299,4 +2299,12 @@ object KyuubiConf {
       .version("1.7.0")
       .timeConf
       .createWithDefault(Duration.ofSeconds(60).toMillis)
+
+  val ENGINE_POOL_BALANCE_EXPAND_THRESHOLD: ConfigEntry[Int] =
+    buildConf("kyuubi.engine.expand.threshold")

Review Comment:
   we don't need this new configuration and `kyuubi.engine.pool.size.threshold` can be reused I think.
   
   This feature eventually will be more flexible, but let's start w/ a minimal step to make the PR get in master first.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on pull request #3697: [KYUUBI #3695]Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1293603550

   @CHzxp I roughly understand what you are trying to do by reading the description and code. Basically, I think it's a good idea, but the code needs to be polished before getting in, and have an offline discussion w/ @cxzl25, he has a similar idea but sounds more mature.
   
   Anyway, it's a good start, @cxzl25 would you please share more about your idea? Then we can discuss the design details and split it into multi PRs for implementation, this one could be part of the whole plan.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] cxzl25 commented on a diff in pull request #3697: [KYUUBI #3695] Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
cxzl25 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1009068368


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala:
##########
@@ -96,32 +125,6 @@ private[kyuubi] class EngineRef(
     case _ => user
   }
 
-  @VisibleForTesting
-  private[kyuubi] val subdomain: String = conf.get(ENGINE_SHARE_LEVEL_SUBDOMAIN) match {
-    case Some(_subdomain) => _subdomain
-    case None if clientPoolSize > 0 =>
-      val poolSize = math.min(clientPoolSize, poolThreshold)
-      if (poolSize < clientPoolSize) {
-        warn(s"Request engine pool size($clientPoolSize) exceeds, fallback to " +
-          s"system threshold $poolThreshold")
-      }
-      val seqNum = enginePoolBalancePolicy match {
-        case "POLLING" =>

Review Comment:
   Why remove the `POLLING` policy?



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] codecov-commenter commented on pull request #3697: [KYUUBI #3695] Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1309070685

   # [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3697](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (cfa270e) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/2b1a1f17260a04419d856d9152daba520577f839?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2b1a1f1) will **increase** coverage by `0.32%`.
   > The diff coverage is `44.44%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3697      +/-   ##
   ============================================
   + Coverage     52.44%   52.77%   +0.32%     
     Complexity       13       13              
   ============================================
     Files           490      498       +8     
     Lines         27650    28097     +447     
     Branches       3824     3869      +45     
   ============================================
   + Hits          14502    14829     +327     
   - Misses        11761    11868     +107     
   - Partials       1387     1400      +13     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ain/scala/org/apache/kyuubi/engine/EngineRef.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvRW5naW5lUmVmLnNjYWxh) | `66.89% <31.81%> (-6.96%)` | :arrow_down: |
   | [.../engine/reblance/RebalancedSparkEnginePolicy.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvcmVibGFuY2UvUmViYWxhbmNlZFNwYXJrRW5naW5lUG9saWN5LnNjYWxh) | `31.81% <31.81%> (ø)` | |
   | [...in/scala/org/apache/kyuubi/config/KyuubiConf.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jb25maWcvS3l1dWJpQ29uZi5zY2FsYQ==) | `97.47% <100.00%> (-0.07%)` | :arrow_down: |
   | [...e/kyuubi/engine/reblance/HandleSpaceRecorder.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvcmVibGFuY2UvSGFuZGxlU3BhY2VSZWNvcmRlci5zY2FsYQ==) | `100.00% <100.00%> (ø)` | |
   | [.../org/apache/kyuubi/session/KyuubiSessionImpl.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXNzaW9uL0t5dXViaVNlc3Npb25JbXBsLnNjYWxh) | `77.04% <100.00%> (+1.82%)` | :arrow_up: |
   | [...g/apache/kyuubi/session/KyuubiSessionManager.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXNzaW9uL0t5dXViaVNlc3Npb25NYW5hZ2VyLnNjYWxh) | `89.74% <100.00%> (+0.08%)` | :arrow_up: |
   | [...rg/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY21kL2xvZy9Mb2dCYXRjaENvbW1hbmQuc2NhbGE=) | `65.57% <0.00%> (-12.43%)` | :arrow_down: |
   | [...va/org/apache/kyuubi/client/api/v1/dto/Engine.java](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXJlc3QtY2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9reXV1YmkvY2xpZW50L2FwaS92MS9kdG8vRW5naW5lLmphdmE=) | `60.34% <0.00%> (-11.75%)` | :arrow_down: |
   | [...rg/apache/kyuubi/ctl/cli/ControlCliArguments.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY2xpL0NvbnRyb2xDbGlBcmd1bWVudHMuc2NhbGE=) | `32.09% <0.00%> (-0.41%)` | :arrow_down: |
   | [...a/org/apache/kyuubi/service/TFrontendService.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2aWNlL1RGcm9udGVuZFNlcnZpY2Uuc2NhbGE=) | `90.98% <0.00%> (-0.19%)` | :arrow_down: |
   | ... and [45 more](https://codecov.io/gh/apache/incubator-kyuubi/pull/3697/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on a diff in pull request #3697: [KYUUBI #3695] Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
CHzxp commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1009093010


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala:
##########
@@ -96,32 +125,6 @@ private[kyuubi] class EngineRef(
     case _ => user
   }
 
-  @VisibleForTesting
-  private[kyuubi] val subdomain: String = conf.get(ENGINE_SHARE_LEVEL_SUBDOMAIN) match {
-    case Some(_subdomain) => _subdomain
-    case None if clientPoolSize > 0 =>
-      val poolSize = math.min(clientPoolSize, poolThreshold)
-      if (poolSize < clientPoolSize) {
-        warn(s"Request engine pool size($clientPoolSize) exceeds, fallback to " +
-          s"system threshold $poolThreshold")
-      }
-      val seqNum = enginePoolBalancePolicy match {
-        case "POLLING" =>

Review Comment:
   ok  i will pull master code and merge it .  



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030543803


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -1552,7 +1552,7 @@ object KyuubiConf {
       .version("1.7.0")
       .stringConf
       .transform(_.toUpperCase(Locale.ROOT))
-      .checkValues(Set("RANDOM", "POLLING"))
+      .checkValues(Set("RANDOM", "POLLING", "REBALANCED"))

Review Comment:
   How about naming it "ADAPTIVE"?



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030561324


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/reblance/RebalancedSparkEnginePolicy.scala:
##########
@@ -0,0 +1,190 @@
+/*
+ * 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.kyuubi.engine.reblance
+
+import scala.collection.mutable
+import scala.collection.mutable.ListBuffer
+
+import org.apache.commons.lang.StringUtils
+
+import org.apache.kyuubi.Logging
+import org.apache.kyuubi.config.KyuubiConf
+import org.apache.kyuubi.config.KyuubiConf.{ENGINE_INIT_TIMEOUT, ENGINE_POOL_BALANCE_EXPAND_THRESHOLD, ENGINE_POOL_BALANCE_POLICY}
+import org.apache.kyuubi.ha.client.{DiscoveryClient, DiscoveryPaths}
+import org.apache.kyuubi.ha.client.DiscoveryClientProvider.withDiscoveryClient
+import org.apache.kyuubi.session.SessionHandle
+
+object RebalancedSparkEnginePolicy extends Logging {

Review Comment:
   It is not specific to Spark but all engines.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030572626


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/reblance/RebalancedSparkEnginePolicy.scala:
##########
@@ -0,0 +1,190 @@
+/*
+ * 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.kyuubi.engine.reblance
+
+import scala.collection.mutable
+import scala.collection.mutable.ListBuffer
+
+import org.apache.commons.lang.StringUtils
+
+import org.apache.kyuubi.Logging
+import org.apache.kyuubi.config.KyuubiConf
+import org.apache.kyuubi.config.KyuubiConf.{ENGINE_INIT_TIMEOUT, ENGINE_POOL_BALANCE_EXPAND_THRESHOLD, ENGINE_POOL_BALANCE_POLICY}
+import org.apache.kyuubi.ha.client.{DiscoveryClient, DiscoveryPaths}
+import org.apache.kyuubi.ha.client.DiscoveryClientProvider.withDiscoveryClient
+import org.apache.kyuubi.session.SessionHandle
+
+object RebalancedSparkEnginePolicy extends Logging {
+
+  private val sessionNodeSuffix = "-session"
+
+  def deleteHandlePath(

Review Comment:
   "handle" is really a confusing name, we have "session handle", "engine handle", "operator handle", etc. eliminating the subject and only keeping "handle" means nothing.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030613644


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala:
##########
@@ -259,6 +274,15 @@ private[kyuubi] class EngineRef(
     }
   }
 
+  private def removeFailedHandleSpace(): Unit = {
+    val sessionRecordNode = SessionNodeUtil.combine2SessionNode(engineSpace)
+    val closeHandleSpace = s"$sessionRecordNode/$engineRefId"
+    RebalancedSparkEnginePolicy.deleteHandlePath(
+      conf,
+      closeHandleSpace,
+      SpaceBean(getCommonParent, user))

Review Comment:
   please avoid using "bean", it's only popular on projects using the EJB / Spring framework.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030557127


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala:
##########
@@ -105,20 +107,28 @@ private[kyuubi] class EngineRef(
         warn(s"Request engine pool size($clientPoolSize) exceeds, fallback to " +
           s"system threshold $poolThreshold")
       }
-      val seqNum = enginePoolBalancePolicy match {
+      val finallySubdomain = enginePoolBalancePolicy match {

Review Comment:
   this variable is redundant, please remove it to simplify the code.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on pull request #3697: [KYUUBI #3695]Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1291462613

   Thanks @CHzxp, I will take a look ASAP, and would you please rebase your branch on upstream master first? there is conflict now.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on pull request #3697: [KYUUBI #3695]Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
CHzxp commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1294395966

   @pan3793  , thank you review code, i will polish my code ASAP .


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030557127


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala:
##########
@@ -105,20 +107,28 @@ private[kyuubi] class EngineRef(
         warn(s"Request engine pool size($clientPoolSize) exceeds, fallback to " +
           s"system threshold $poolThreshold")
       }
-      val seqNum = enginePoolBalancePolicy match {
+      val finallySubdomain = enginePoolBalancePolicy match {

Review Comment:
   this variable is redundant, please remove it to simplify the code.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on pull request #3697: [KYUUBI #3695]Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
CHzxp commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1294384516

   @cxzl25,@pan3793 how can get connection with @cxzl25 for discussion the issue. 


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030574812


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/reblance/HandleSpaceRecorder.scala:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.kyuubi.engine.reblance
+
+import scala.collection.mutable
+
+import org.apache.commons.lang.StringUtils
+
+import org.apache.kyuubi.Logging
+class HandleSpaceRecorder extends Logging {

Review Comment:
   I think this wrapper is not necessary, we can use a Map directly, and please take care of concurrency issue.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
CHzxp commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1337540707

    
   ![kyuubi-adaptive-design](https://user-images.githubusercontent.com/28837422/205671059-bc4dc80f-ea84-48e8-a4c0-996bd3b7327a.png)
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on pull request #3697: [KYUUBI #3695] Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
CHzxp commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1309843139

   @pan3793 @cxzl25 please look at  my code


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030547857


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -2299,4 +2299,12 @@ object KyuubiConf {
       .version("1.7.0")
       .timeConf
       .createWithDefault(Duration.ofSeconds(60).toMillis)
+
+  val ENGINE_POOL_BALANCE_EXPAND_THRESHOLD: ConfigEntry[Int] =
+    buildConf("kyuubi.engine.expand.threshold")

Review Comment:
   we don't need this new configuration and `kyuubi.engine.pool.size.threshold` can be reused I think.
   
   This feature eventually will be more flexible, but let's start w/ a minimal step to make the PR get in master first.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on pull request #3697: [KYUUBI #3695]Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
CHzxp commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1291465543

   Thanks @pan3793, i will deal conflicks ASAP.Thank you!


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1030572626


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/reblance/RebalancedSparkEnginePolicy.scala:
##########
@@ -0,0 +1,190 @@
+/*
+ * 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.kyuubi.engine.reblance
+
+import scala.collection.mutable
+import scala.collection.mutable.ListBuffer
+
+import org.apache.commons.lang.StringUtils
+
+import org.apache.kyuubi.Logging
+import org.apache.kyuubi.config.KyuubiConf
+import org.apache.kyuubi.config.KyuubiConf.{ENGINE_INIT_TIMEOUT, ENGINE_POOL_BALANCE_EXPAND_THRESHOLD, ENGINE_POOL_BALANCE_POLICY}
+import org.apache.kyuubi.ha.client.{DiscoveryClient, DiscoveryPaths}
+import org.apache.kyuubi.ha.client.DiscoveryClientProvider.withDiscoveryClient
+import org.apache.kyuubi.session.SessionHandle
+
+object RebalancedSparkEnginePolicy extends Logging {
+
+  private val sessionNodeSuffix = "-session"
+
+  def deleteHandlePath(

Review Comment:
   "handle" is really a confusing name, we have "session handle", "engine handle", "operator handle", etc. and naming "handle" means nothing.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1325308058

   I left some comments but TBH I don't fully understand the implementation detail, because the variables/methods name is confusing to me.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on a diff in pull request #3697: [KYUUBI #3695] ADAPTIVE policy to dynamic expand or reduce engine pool size

Posted by GitBox <gi...@apache.org>.
CHzxp commented on code in PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#discussion_r1038984194


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -1552,7 +1552,7 @@ object KyuubiConf {
       .version("1.7.0")
       .stringConf
       .transform(_.toUpperCase(Locale.ROOT))
-      .checkValues(Set("RANDOM", "POLLING"))
+      .checkValues(Set("RANDOM", "POLLING", "REBALANCED"))

Review Comment:
   accept it, i have modify it to ADAPTIVE



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] CHzxp commented on pull request #3697: [KYUUBI #3695] Add new policy that support dynamic expand or decrease engin according to engin load

Posted by GitBox <gi...@apache.org>.
CHzxp commented on PR #3697:
URL: https://github.com/apache/incubator-kyuubi/pull/3697#issuecomment-1298605783

   please help me review my code, thanks


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org