VM环境中测试nginx_lua读取POST请求函数性能影响


主要函数:

ngx.req.read_body()

ngx.req.get_post_args()

nginx配置:

events {
  use epoll;
  multi_accept off;
  worker_connections  10240;
}
 location /set {
             content_by_lua_block {

                 ngx.status = 404
                 ngx.header.content_type="text/html"
                 ngx.req.read_body()
                 ngx.say('yes')
                 ngx.say("STOREDsss"..ngx.req.get_post_args())
             }
         }

测试请求:

POST: http://192.168.109.131/set?a1=a1&a2=a2&a3=a3&a4=a4&a5=a5&a6=a6&a7=a7&a8=a8&a9=a9&a10=a10&a11=a11&a12=a12&a13=a13&a14=a14&a15=a15&a16=a16&a17=a17&a18=a18&a19=a19&a20=a20&id=script

Data:a1=a1&a2=a2&a3=a3&a4=a4&a5=a5&a6=a6&a7=a7&a8=a8&a9=a9&a10=a10&a11=a11&a12=a12&a13=a13&a14=a14&a15=a15&a16=a16&a17=a17&a18=a18&a19=a19&a20=a20

测试结果:

  • 在不读取post数据时,获得的结果测试:

  • 去掉读取post数据时,获得的测试结果

但是在物理机器上发现两种请求影响几乎为0

results matching ""

    No results matching ""