documentation icon indicating copy to clipboard operation
documentation copied to clipboard

nginx configuration example produces slow requests

Open ChristianStornowski opened this issue 1 year ago • 1 comments

I executed wrk on the same host where nginx is installed and serves https://nextcloud.example.com. I followed this guide https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html#nextcloud-in-the-webroot-of-nginx

wrk -t 1 -c 1 -d 60 https://nextcloud.example.com

 1 threads and 1 connections
   Thread Stats   Avg      Stdev     Max   +/- Stdev
     Latency    20.06ms    2.78ms  42.31ms   90.04%
     Req/Sec    49.83      5.20    60.00     73.00%
   2990 requests in 1.00m, 4.38MB read
Requests/sec:     49.80
Transfer/sec:     74.65KB

wrk -t 1 -c 1 -d 60 https://nextcloud.example.com/login

1 threads and 1 connections
   Thread Stats   Avg      Stdev     Max   +/- Stdev
     Latency    26.46ms    3.34ms  41.12ms   90.48%
     Req/Sec    37.80      4.19    40.00     78.17%
   2268 requests in 1.00m, 38.17MB read
Requests/sec:     37.77
Transfer/sec:    650.96KB

wrk -t 1 -c 1 -d 60 https://nextcloud.example.com/dist/core-common.js

   1 threads and 1 connections
   Thread Stats   Avg      Stdev     Max   +/- Stdev
     Latency     9.91ms    1.15ms  17.53ms   90.53%
     Req/Sec   101.24      8.46   111.00     49.75%
   6059 requests in 1.00m, 87.51GB read
Requests/sec:    100.82
Transfer/sec:      1.46GB

Using

location / {
                 try_files $uri /index.php$request_uri;
         }

instead of

location / {
                 try_files $uri $uri/ /index.php$request_uri;
         }

increased performance.

ChristianStornowski avatar Nov 14 '23 08:11 ChristianStornowski

Can you show which performance exactly increased for you? Adding $uri / only checks if a directory exists, but I fail to see right now which performance is increased? For reference see also https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#front-controller-pattern-web-apps

SystemKeeper avatar Dec 09 '23 18:12 SystemKeeper