You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/02/02 09:22:25 UTC

[GitHub] [apisix] redynasc opened a new pull request #3493: feat: smooth weighted round-robin

redynasc opened a new pull request #3493:
URL: https://github.com/apache/apisix/pull/3493


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   ### Pre-submission checklist:
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) 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.

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



[GitHub] [apisix] tokers commented on a change in pull request #3493: feat: smooth weighted round-robin

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #3493:
URL: https://github.com/apache/apisix/pull/3493#discussion_r568583419



##########
File path: apisix/schema_def.lua
##########
@@ -323,7 +323,7 @@ local upstream_schema = {
         type = {
             description = "algorithms of load balancing",
             type = "string",
-            enum = {"chash", "roundrobin", "ewma", "least_conn"}
+            enum = {"chash", "roundrobin", "ewma", "least_conn", "swrr"}

Review comment:
       I'm inclined to optimize the current roundrobin loadbalancer, not creating a new one, the `roundrobin` and `swrr` are same in essence.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] github-actions[bot] closed pull request #3493: feat: smooth weighted round-robin

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #3493:
URL: https://github.com/apache/apisix/pull/3493


   


-- 
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@apisix.apache.org

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



[GitHub] [apisix] github-actions[bot] commented on pull request #3493: feat: smooth weighted round-robin

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #3493:
URL: https://github.com/apache/apisix/pull/3493#issuecomment-915100838


   This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
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@apisix.apache.org

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



[GitHub] [apisix] spacewander commented on a change in pull request #3493: feat: smooth weighted round-robin

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3493:
URL: https://github.com/apache/apisix/pull/3493#discussion_r569081352



##########
File path: apisix/balancer/swrr.lua
##########
@@ -0,0 +1,109 @@
+--
+-- 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.
+--
+local core = require("apisix.core")
+local nkeys = core.table.nkeys
+local pairs = pairs
+local next = next
+local _M = {}
+
+local function find(self, tried)
+    local number = #self.nodes
+    if number == 1 then

Review comment:
       We don't need this as we only create balancer when #nodes > 1




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #3493: feat: smooth weighted round-robin

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3493:
URL: https://github.com/apache/apisix/pull/3493#discussion_r569084225



##########
File path: apisix/schema_def.lua
##########
@@ -323,7 +323,7 @@ local upstream_schema = {
         type = {
             description = "algorithms of load balancing",
             type = "string",
-            enum = {"chash", "roundrobin", "ewma", "least_conn"}
+            enum = {"chash", "roundrobin", "ewma", "least_conn", "swrr"}

Review comment:
       The magical number `5` can be configured, so if we choice 0 the `swrr` will be used instead.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #3493: feat: smooth weighted round-robin

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3493:
URL: https://github.com/apache/apisix/pull/3493#discussion_r569080828



##########
File path: apisix/schema_def.lua
##########
@@ -323,7 +323,7 @@ local upstream_schema = {
         type = {
             description = "algorithms of load balancing",
             type = "string",
-            enum = {"chash", "roundrobin", "ewma", "least_conn"}
+            enum = {"chash", "roundrobin", "ewma", "least_conn", "swrr"}

Review comment:
       This implementation is more fair when `(max weight - second max weight) / gcd` is large. 
   
   @redynasc 
   Maybe we need to put this as part of the original rr algorithm?
   We can choice this one if `(max weight - second max weight) / gcd > 5`.
   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.

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



[GitHub] [apisix] github-actions[bot] commented on pull request #3493: feat: smooth weighted round-robin

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #3493:
URL: https://github.com/apache/apisix/pull/3493#issuecomment-935891525


   This pull request/issue has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.


-- 
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@apisix.apache.org

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



[GitHub] [apisix] tokers commented on a change in pull request #3493: feat: smooth weighted round-robin

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #3493:
URL: https://github.com/apache/apisix/pull/3493#discussion_r568583419



##########
File path: apisix/schema_def.lua
##########
@@ -323,7 +323,7 @@ local upstream_schema = {
         type = {
             description = "algorithms of load balancing",
             type = "string",
-            enum = {"chash", "roundrobin", "ewma", "least_conn"}
+            enum = {"chash", "roundrobin", "ewma", "least_conn", "swrr"}

Review comment:
       I'm inclined to optimize the current roundrobin loadbalancer, not creating a new one, the `roundrobin` and `swrr` are same in essence.




----------------------------------------------------------------
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:
users@infra.apache.org