Skip to content

Commit

Permalink
perf(clustering) log push_config duration to help debugging config …
Browse files Browse the repository at this point in the history
…export performance

Co-authored-by: Datong Sun <datong.sun@konghq.com>
Co-authored-by: Harry <harrybagdi@gmail.com>
  • Loading branch information
3 people committed May 11, 2022
1 parent 78fa687 commit 1265280
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kong/clustering/control_plane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ local ngx_exit = ngx.exit
local exiting = ngx.worker.exiting
local ngx_time = ngx.time
local ngx_now = ngx.now
local ngx_update_time = ngx.update_time
local ngx_var = ngx.var
local table_insert = table.insert
local table_remove = table.remove
Expand Down Expand Up @@ -248,6 +249,8 @@ end


function _M:push_config()
local start = ngx_now()

local payload, err = self:export_deflated_reconfigure_payload()
if not payload then
ngx_log(ngx_ERR, _log_prefix, "unable to export config from database: ", err)
Expand All @@ -261,7 +264,9 @@ function _M:push_config()
n = n + 1
end

ngx_log(ngx_DEBUG, _log_prefix, "config pushed to ", n, " clients")
ngx_update_time()
local duration = ngx_now() - start
ngx_log(ngx_DEBUG, _log_prefix, "config pushed to ", n, " data-plane nodes in " .. duration .. " seconds")
end


Expand Down

0 comments on commit 1265280

Please sign in to comment.