data="" (Georg Young)","publisher":{"id":"ce5416f959f949c4bd2d748f2df511a2","name":"LAMETINA HOLDINGS LTD."},"storeurl":"https://itunes.apple.com/app/id661041542","ver":"1.7"},"at":2,"bcat":["IAB7-39","IAB9-9","IAB25","IAB26"],"device":{"carrier":"520-03","connectiontype":3,"devicetype":1,"dnt":0,"dpidmd5":"1fbf8cfc5c5f093c621659a6494b322b","dpidsha1":"bcf9b8da0dd2af7670ffeb442def46eed7a76638","ext":{"idfa":"5D801360-0E2F-472F-B8D2-8A098E51BA17"},"geo":{"city":"Bangkok","country":"THA","region":"40"},"ip":"49.230.57.7","js":1,"language":"th","make":"Apple","model":"iPhone 4S","os":"iOS","osv":"7.0.4","ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11B554a"},"id":"1748b105-e8c5-4feb-bef5-348200ad02cc","imp":[{"banner":{"api":[3,5],"battr":[8,9,10,14,6],"btype":[4],"ext":{"nativebrowserclick":1},"h":50,"pos":1,"w":320},"bidfloor":0.080,"displaymanager":"mopub","displaymanagerver":"3.3.0","ext":{"secure":0},"id":"1","instl":0,"tagid":"de520c4ccb0f4f94af8dc22298dd03b4"}]}
On Wednesday, February 17, 2016 at 3:07:20 PM UTC-8, 黄川 wrote:
各位大神,遇到一个棘手的问题,我发现我们的request latency比较高,用如下code profile之后发现ngx.req.read_body()会耗费27-70毫秒 (0.027-0.7s,好像要么0.03s左右要么0.065秒左右,没有中间的),这一个函数占用了绝大部份的时间,不知道是否大家见过这个问题?是不是只能这么读request? 谢谢!
location = /reqest {
client_max_body_size 50k;
client_body_buffer_size 50k;
content_by_lua_block {
start_time = ngx.now()
log(WARN, "=====1: ", ngx.now() - start_time)
-- explicitly read the req body
ngx.req.read_body()
log(WARN, "=====2: ", ngx.now() - start_time)
local data = "">
if not data then
ngx.status = 204
ngx.header.content_type = 'text/html'
ngx.say("")
return
end
log(WARN, "=====3: ", ngx.now() - start_time)
2016/02/17 23:00:58 [warn] 30721#0: *327 [lua] content_by_lua(nginx.conf:196):24: =====1: 0, client: 192.48.237.171, server: localhost, request: "POST /ad_server_v2_bin HTTP/1.1", host: "mopub.frac
2016/02/17 23:00:58 [warn] 30721#0: *326 [lua] content_by_lua(nginx.conf:196):28: =====2: 0.067000150680542, client: 192.48.237.171, server: localhost, request: "POST /ad_server_v2_bin HTTP/1.1", h
2016/02/17 23:00:58 [warn] 30721#0: *326 [lua] content_by_lua(nginx.conf:196):37: =====3: 0.067000150680542, client: 192.48.237.171, server: localhost, request: "POST /ad_server_v2_bin HTTP/1.1", h