I tried both ngrest simple server and nginx module. ngrest simple server works just well even on large responses > 100MB.
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:9098... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Content-Type: application/json
Server: ngrest
Content-Length: 108277792
Date: Sat, Nov 24 2018 09:51:05 GMT
Connection: Keep-Alive
Length: 108277792 (103M) [application/json]
Saving to: ‘get1’
get1 100%[=================================================================================>] 103,26M 449MB/s in 0,2s
2018-11-24 12:51:05 (449 MB/s) - ‘get1’ saved [108277792/108277792]
nginx module works when response is less than about 2 MB.
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: nginx/1.10.1
Date: Sat, 24 Nov 2018 09:46:26 GMT
Content-Type: application/json
Content-Length: 2107792
Connection: close
Length: 2107792 (2,0M) [application/json]
Saving to: ‘get1’
get1 100%[=================================================================================>] 2,01M --.-KB/s in 0,004s
2018-11-24 12:46:26 (568 MB/s) - ‘get1’ saved [2107792/2107792]
but when response is larger than about 2,5 MB it may stuck or close connection.
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: nginx/1.10.1
Date: Sat, 24 Nov 2018 09:49:08 GMT
Content-Type: application/json
Content-Length: 21477792
Connection: close
Length: 21477792 (20M) [application/json]
Saving to: ‘get1.1’
get1.1 98%[===============================================================================> ] 20,10M --.-KB/s eta 0s
this may be related to the problem you described.
By the module logs all memory blocks are written to the chain, but ngx_http_output_filter returns NGX_AGAIN error upon request finalization. I'm not sure how to handle it correctly. This may be the error. Because when response is smaller, and it works correctly ngx_http_output_filter returns no error.
I'm not expert on creating nginx modules, so any help of fixing this is appreciated.
четверг, 22 ноября 2018 г., 8:34:46 UTC+3 пользователь m*****
4...@gmail.com написал: