lua_shared_dict run_task 1m;
lua_max_pending_timers 81290;
lua_max_running_timers 81290;
server {
listen 127.0.0.1:8080;
server_name localhost;
location /test_timer_at {
default_type 'text/plain';
lua_code_cache on;
content_by_lua_file conf/test_timer_at.lua;
}
local ngx = ngx
local timer_at = ngx.timer.at
local collectgarbage = collectgarbage
local function test_func(premature)
local run_task = ngx.shared.run_task
local val, err = run_task:get('task_num')
if not val then
run_task:set('task_num', 1)
else
run_task:incr('task_num', 1)
end
ngx.sleep(60)
ngx.log(ngx.ERR, "create a timer at")
run_task:incr('task_num', -1)
end
local function test_timer_at()
for i = 1, 10000 do
timer_at(0, test_func)
end
end
test_timer_at()
local run_task = ngx.shared.run_task
local val, err = run_task:get('task_num')
if val then
ngx.say("{\"result\":\"ok\", \"task_num\":"..tostring(val).."}")
else
ngx.say("{\"result\":\"no\", \"task_num\":\"0\"}")
end
collectgarbage('collect')
2016-06-21 19:34:25 nobody 2446 2.0 1.3 67920 27980 ? S 19:34 0:00 nginx: worker process
2016-06-21 19:34:30 nobody 2446 0.3 1.3 67920 27980 ? S 19:34 0:00 nginx: worker process
2016-06-21 19:34:35 nobody 2446 0.1 1.3 67920 27980 ? S 19:34 0:00 nginx: worker process
2016-06-21 19:34:40 nobody 2446 0.1 1.3 67920 27980 ? S 19:34 0:00 nginx: worker process
2016-06-21 19:34:45 nobody 2446 9.7 5.0 141268 102272 ? R 19:34 0:02 nginx: worker process
2016-06-21 19:34:51 nobody 2446 27.2 5.0 141268 102272 ? R 19:34 0:07 nginx: worker process
2016-06-21 19:34:56 nobody 2446 39.0 5.0 141268 102272 ? R 19:34 0:12 nginx: worker process
2016-06-21 19:35:06 nobody 2446 54.1 5.0 141268 102272 ? R 19:34 0:22 nginx: worker process
2016-06-21 19:35:11 nobody 2446 59.3 5.8 157016 118644 ? R 19:34 0:27 nginx: worker process
2016-06-21 19:35:16 nobody 2446 61.0 12.5 295768 257292 ? S 19:34 0:31 nginx: worker process
2016-06-21 19:35:42 nobody 2446 72.3 12.5 295768 257292 ? R 19:34 0:55 nginx: worker process
2016-06-21 19:35:47 nobody 2446 74.0 12.5 295768 257292 ? S 19:34 1:00 nginx: worker process
2016-06-21 19:35:52 nobody 2446 69.7 12.5 295768 257292 ? S 19:34 1:00 nginx: worker process
2016-06-21 19:35:57 nobody 2446 65.9 12.5 295768 257292 ? S 19:34 1:00 nginx: worker process
2016-06-21 19:36:02 nobody 2446 62.5 12.5 295768 257292 ? S 19:34 1:00 nginx: worker process
2016-06-21 19:36:07 nobody 2446 59.0 12.5 295768 257292 ? R 19:34 1:00 nginx: worker process
2016-06-21 19:36:12 nobody 2446 59.2 12.1 287704 249144 ? R 19:34 1:04 nginx: worker process
2016-06-21 19:36:17 nobody 2446 61.1 12.5 294360 255744 ? R 19:34 1:09 nginx: worker process
2016-06-21 19:36:23 nobody 2446 62.7 12.9 304472 264988 ? R 19:34 1:14 nginx: worker process
2016-06-21 19:36:28 nobody 2446 64.3 12.9 304472 264988 ? R 19:34 1:19 nginx: worker process
2016-06-21 19:36:33 nobody 2446 65.8 12.9 304472 264988 ? R 19:34 1:24 nginx: worker process
2016-06-21 19:36:38 nobody 2446 67.2 12.9 304472 264988 ? R 19:34 1:29 nginx: worker process
2016-06-21 19:36:43 nobody 2446 65.2 12.9 304472 264988 ? S 19:34 1:30 nginx: worker process
2016-06-21 19:36:48 nobody 2446 63.0 12.9 304472 264988 ? S 19:34 1:30 nginx: worker process
2016-06-21 19:36:53 nobody 2446 62.3 12.9 304472 264988 ? R 19:34 1:32 nginx: worker process
2016-06-21 19:36:59 nobody 2446 63.4 12.9 304472 264988 ? R 19:34 1:37 nginx: worker process
2016-06-21 19:37:04 nobody 2446 64.6 12.9 304472 264988 ? R 19:34 1:42 nginx: worker process
2016-06-21 19:37:09 nobody 2446 65.6 12.9 304472 264988 ? R 19:34 1:47 nginx: worker process
2016-06-21 19:37:14 nobody 2446 66.2 12.4 292824 253480 ? R 19:34 1:52 nginx: worker process
2016-06-21 19:37:19 nobody 2446 67.3 13.9 324696 285328 ? R 19:34 1:57 nginx: worker process