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/07/06 05:51:49 UTC

[GitHub] [incubator-apisix] membphis edited a comment on issue #1804: performance: spend more time on ssl handshake

membphis edited a comment on issue #1804:
URL: https://github.com/apache/incubator-apisix/issues/1804#issuecomment-654028330


   I tested it on my local computer and reproduced the problem.
   
   Here is the flame graph of `no-reuse-session`:
   [perf-no-reuse-session.svg.zip](https://github.com/apache/incubator-apisix/files/4876949/perf-no-reuse-session.svg.zip)
   
   Here is the flame graph of `reuse-session`:
   [perf-reuse-session.svg.zip](https://github.com/apache/incubator-apisix/files/4876951/perf-reuse-session.svg.zip)
   
   When we enabled `reuse-session`, QPS increased by 10 times.
   
   My test code:
   
   ```lua
   local sess = true
   
   local function test()
       local sock = ngx.socket.tcp()
       local ok, err = sock:connect("127.0.0.1", 9443)
       if not ok then
           ngx.say("failed to connect to test.com: ", err)
           return
       end
   
       sess, err = sock:sslhandshake(sess, "test.com")
       if not sess then
           ngx.say("failed to do SSL handshake: ", err)
           return
       end
   
       -- ngx.say("ssl handshake: ", type(sess))
   
       local req = "GET /index.html HTTP/1.1\r\nHost: test.com\r\nConnection: keepalive\r\n\r\n"
       local bytes, err = sock:send(req)
       if not bytes then
           ngx.say("failed to send http request: ", err)
           return
       end
   
       local line, err = sock:receive()
       if not line then
           ngx.say("failed to receive response status line: ", err)
           return
       end
   
       -- ngx.say("received: ", line)
   
       local ok, err = sock:close()
       -- ngx.say("close: ", ok, " ", err)
   end
   
   for i = 1, 1000 * 100 do
       test()
   end
   ```


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