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 2020/01/19 14:49:12 UTC

[GitHub] [incubator-apisix] Miss-you opened a new pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Miss-you opened a new pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085
 
 
   NOTE: Please read the Contributing.md guidelines before submitting your patch:
   
   https://github.com/apache/incubator-apisix/blob/master/Contributing.md#how-to-add-a-new-feature-or-change-an-existing-one
   
   ### Summary
   
   Modify bin/apisix to increase the capacity so that the generated nginx.conf file can open the reuseport configuration
       Judgment logic:
       1. If it is a mac system, do not open reuseport
       2. If it is a linux system and the kernel version is higher than 3.9.0, then turn on the reuserport switch, and the reuseport option will be added when generating nginx.conf> configuration
   
   ### Full changelog
   
   bin/apisix
   
   ### Issues resolved
   
   Fix #342 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-583718295
 
 
   ![image](https://user-images.githubusercontent.com/6814606/74082498-8a5aa400-4a95-11ea-81ac-2b202e03441c.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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] Miss-you commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
Miss-you commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-581394596
 
 
   Considering that the kernel version of the current production environment basically supports reuseport, I think it is more reasonable to open the REUSEPORT configuration file by default and supporting configuration 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] Miss-you commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
Miss-you commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#discussion_r375967337
 
 

 ##########
 File path: conf/config.yaml
 ##########
 @@ -21,7 +21,7 @@ apisix:
   enable_admin_cors: true         # Admin API support CORS response headers.
   enable_debug: false
   enable_dev_mode: false          # Sets nginx worker_processes to 1 if set to true
-  enable_reuseport: true          # Enable nginx SO_REUSEPORT switch if set to true.
+  enable_reuseport: false          # Enable nginx SO_REUSEPORT switch if set to true.
 
 Review comment:
   setting enable_reuseport false to verify that test cases are working.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-582817205
 
 
   waiting your test case ^_^

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#discussion_r375609383
 
 

 ##########
 File path: bin/apisix
 ##########
 @@ -530,6 +531,10 @@ local function init()
         sys_conf["worker_processes"] = "auto"
     end
 
+    if sys_conf["enable_reuseport"] == false then
+        enable_reuseport = false
+    end
+
 
 Review comment:
   we can use the `enable_reuseport` in `config.yaml`

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] Miss-you commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
Miss-you commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-582484553
 
 
   @membphis @spacewander 
   hi, I have add the 'enable_reuseport' config into config.yaml. Please take a look.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis edited a comment on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis edited a comment on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-583718295
 
 
   https://travis-ci.org/apache/incubator-apisix/jobs/647645479#L1426
   
   ![image](https://user-images.githubusercontent.com/6814606/74082498-8a5aa400-4a95-11ea-81ac-2b202e03441c.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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis merged pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis merged pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085
 
 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#discussion_r375808647
 
 

 ##########
 File path: conf/config.yaml
 ##########
 @@ -21,7 +21,7 @@ apisix:
   enable_admin_cors: true         # Admin API support CORS response headers.
   enable_debug: false
   enable_dev_mode: false          # Sets nginx worker_processes to 1 if set to true
-  enable_reuseport: true          # Enable nginx SO_REUSEPORT switch if set to true.
+  enable_reuseport: false          # Enable nginx SO_REUSEPORT switch if set to true.
 
 Review comment:
   default value `true` is better

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] Miss-you commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
Miss-you commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#discussion_r375708102
 
 

 ##########
 File path: bin/apisix
 ##########
 @@ -530,6 +531,10 @@ local function init()
         sys_conf["worker_processes"] = "auto"
     end
 
+    if sys_conf["enable_reuseport"] == false then
+        enable_reuseport = false
+    end
+
 
 Review comment:
   done

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#discussion_r376167208
 
 

 ##########
 File path: conf/config.yaml
 ##########
 @@ -21,7 +21,7 @@ apisix:
   enable_admin_cors: true         # Admin API support CORS response headers.
   enable_debug: false
   enable_dev_mode: false          # Sets nginx worker_processes to 1 if set to true
-  enable_reuseport: true          # Enable nginx SO_REUSEPORT switch if set to true.
+  enable_reuseport: false          # Enable nginx SO_REUSEPORT switch if set to true.
 
 Review comment:
   For testing, you can write a separate script to modify `config.yaml`.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] Miss-you commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
Miss-you commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#discussion_r375708137
 
 

 ##########
 File path: bin/apisix
 ##########
 @@ -507,6 +507,7 @@ local function init()
         with_module_status = with_module_status,
         node_ssl_listen = 9443,     -- default value
         error_log = {level = "warn"},
+        enable_reuseport = true, -- default true
 
 Review comment:
   done

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] Miss-you edited a comment on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
Miss-you edited a comment on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-577008338
 
 
   @moonming Test cases will be added after pull request # 1063
       https://github.com/apache/incubator-apisix/pull/1063

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-583823118
 
 
   ok, we can merge it to `master` branch first for checking it can work fine.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] spacewander commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-578159583
 
 
   Strictly speaking, detect if a feature is available or not via kernel version is not reliable. Linux distributions may backport kernel patch to an old release (search for "SO_REUSEPORT backport for linux distribution"), not even mentioning self-patched kernel.
   
   I think a better solution is to allow the users to configure it, since they know better about their servers than us. Maybe we can enable this feature by default, because most of the servers have kernel newer than 3.9.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] Miss-you commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
Miss-you commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-577008338
 
 
   @moonming 

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-577061073
 
 
   @Miss-you https://github.com/apache/incubator-apisix/pull/1063 had been merged already.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-581417520
 
 
   > open the REUSEPORT configuration file by default and supporting configuration it.
   
   this way is simpler. thx @spacewander
   
   @Miss-you Expect your new commit ^_^

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] Miss-you commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
Miss-you commented on issue #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#issuecomment-581394946
 
 
   I remember that there are two main pits in reuseport, one is the kernel version, and the other is the support of http2 and http3.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#discussion_r368345746
 
 

 ##########
 File path: bin/apisix
 ##########
 @@ -128,13 +128,26 @@ stream {
     }
 
     server {
+        {% if enable_reuseport then %}
+
+        {% for _, port in ipairs(stream_proxy.tcp or {}) do %}
+        listen {*port*} reuseport;
+        {% end %}
+        {% for _, port in ipairs(stream_proxy.udp or {}) do %}
+        listen {*port*} udp reuseport;
+        {% end %}
+
+        {% else %} {% --if enable_reuseport %}
+
         {% for _, port in ipairs(stream_proxy.tcp or {}) do %}
         listen {*port*};
 
 Review comment:
   `listen {*port*}  {% if enable_reuseport then %} reuseport {% end %};`
   
   This style is simpler.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1085: Modify bin/apisix to support the SO_REUSEPORT
URL: https://github.com/apache/incubator-apisix/pull/1085#discussion_r375609270
 
 

 ##########
 File path: bin/apisix
 ##########
 @@ -507,6 +507,7 @@ local function init()
         with_module_status = with_module_status,
         node_ssl_listen = 9443,     -- default value
         error_log = {level = "warn"},
+        enable_reuseport = true, -- default true
 
 Review comment:
    the default value should be set in `config.yaml`, not here.

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


With regards,
Apache Git Services