Open glukkkk opened 1 year ago
Our config:
{
"listeners": {
"*:${NGINX_PORT}": {
"pass": "routes"
}
},
"routes": [
{
"match": {
"uri": [
"/swagger/*.yaml"
]
},
"action": {
"share": [
"/var/www/app/$uri"
]
}
},
{
"match": {
"uri": "!/index.php"
},
"action": {
"share": "/var/www/app/public/$uri",
"fallback": {
"pass": "applications/wwwapp"
}
}
}
],
"access_log": {
"path": "/dev/stdout",
"format": "{\"request_method\":\"$method\", \"request_uri\":\"$request_uri\", \"request_time\":$request_time, \"status\":$status, \"remote_addr\":\"$remote_addr\", \"http_user_agent\":\"$header_user_agent\"}"
},
"settings": {
"http": {
"max_body_size": ${NGINX_CONF_MAX_BODY_SIZE},
"send_timeout": ${NGINX_CONF_SEND_TIMEOUT},
"large_header_buffers": ${NGINX_CONF_LARGE_HEADER_BUFFERS},
"large_header_buffer_size": ${NGINX_CONF_LARGE_HEADER_BUFFERS_SIZE}
}
},
"applications": {
"wwwapp": {
"type": "php",
"root": "/var/www/app/public",
"script": "index.php",
"processes": 20,
"options": {
"file": "/etc/php.ini"
}
}
}
}
Try setting max, idle_timeout and spare. See https://github.com/islamic-network/api.aladhan.com/blob/681dec1847bff1c5ad988a57b01e595673891def/etc/unit/.unit.conf.json#L15 for instance.
What mentioned by @meezaan should work as an temporary solution.
What do you mean by pretty big JSON? Would like to reproduce this issue.
Just saw it. Sorry 10MB JSON response. We will have a look on it
@tippexs Hello! Any news on this?
Sorry for the late response @glukkkk . We are busy with the WASM Language module we are about to release.
But as I am wolkig on several PHP related tasks after the release (Aug24th) we will look into this!
Thanks! I appreciate it.
We have exactly the same problem as described here: https://github.com/nginx/unit/issues/168.
Our PHP app is based on the Lumen framework. We have a simple route that returns a JSON string of approximately 10MB in size. The script looks really simple:
Then, we start testing it using Siege, an HTTP load tester and benchmarking utility with the concurency number of 50. After 10-20 seconds, the unit:router process starts to consume RAM rapidly. Please take a look at the attached picture. Even after the Siege test is over, the unit:router process still does not free the RAM.
NGINX Unit version: 1.29.1