写了lua一个返回时间戳接口,查看日志,看到很多超过1秒执行时间请求,甚至还有5秒的,代码如下
json = require "cjson"
function o(data)
if ngx == nil then
print(data)
os.exit()
else
ngx.say(data)
ngx.exit(ngx.HTTP_OK)
end
end
callback = ngx.var.arg_callback
local tm = ngx.time()
local data = "">
if callback == nil or string.len(callback) == 0 then
o(json.encode(data))
else
o(callback.."("..json.encode(data)..");")
end
怀疑是不是由于cjson的原因