Performance of Hasura over nginx reverse proxy #6154
-
We have noticed that when adding nginx reverse proxy for the https support, the performance is degrading to approx 7x times (300ms to 2200ms). Is this a known issue? If this is already solved, can we get the ideal conf documented in https://hasura.io/docs/1.0/graphql/core/deployment/enable-https.html TIA |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 8 replies
-
@rrjanbiah Is nginx colocated with the hasura container? |
Beta Was this translation helpful? Give feedback.
-
@tirumaraiselvan Yes (If you meant the same server) |
Beta Was this translation helpful? Give feedback.
-
@rrjanbiah Is it possible to run |
Beta Was this translation helpful? Give feedback.
-
@rrjanbiah You can also enable logging |
Beta Was this translation helpful? Give feedback.
-
@tirumaraiselvan Sure, thanks a lot. Will try that |
Beta Was this translation helpful? Give feedback.
-
@tirumaraiselvan Please find the details that you requested. If you find anything obvious, please share. TIA To get consistent result,
|
Beta Was this translation helpful? Give feedback.
-
From https://github.com/hasura/graphql-engine/files/5515049/access_log_urt.txt, we can see the upstream response time (uct, uht, urt) is more or less ~8ms. Though the total request time seems to vary between 0.2 to 1.2s (rt). Should you be running the Anyway, seems like most of the time is being spent by nginx (probably in SSL handshake). Apart from rerunning the tests from a reliable network, could you also send the |
Beta Was this translation helpful? Give feedback.
-
@tirumaraiselvan Yes sure. |
Beta Was this translation helpful? Give feedback.
-
Directly fetching Hasura from same machine (http on port 8081) with JWT - 31.780 ms mean1.
|
Beta Was this translation helpful? Give feedback.
-
@tirumaraiselvan Forgot to tag you. |
Beta Was this translation helpful? Give feedback.
-
@rrjanbiah I don't think the tcpdump output is capturing container traffic on nginx. Please see this blogpost on one way to capture container traffic: https://medium.com/@xxradar/how-to-tcpdump-effectively-in-docker-2ed0a09b5406 . Another way is to exec into nginx container and run tcpdump:
Moving this to discussions as this is not a core product issue. |
Beta Was this translation helpful? Give feedback.
-
@tirumaraiselvan Apologies for the delay. Still can't figure out about the tcpdump as you wanted. But, based on the suggestion by Reinis Rozitis in the nginx mailing list, found something interesting. DLDR;keep-alive is not triggering in nginx when used with Hasura; but the same works for other REST services. I'm not sure if this is due to any response headers that Hasura is returning, or, due to Hasura's call are in POST. So, IMHO, still this looks like an issue or improvement that required from Hasura end. (FYI @DhvanilPatel) Tools, commands and applications used
Benchmarks and factors
Benchmark - detailed ab resultsnginx - hasura performance - comparision on ab - All data.csv.txt nginx conf files used (simple and optimized) |
Beta Was this translation helpful? Give feedback.
-
Answered here: #6214 |
Beta Was this translation helpful? Give feedback.
Answered here: #6214