GC tuning for high end instances
Problem
Back on https://github.com/PostgREST/postgrest/issues/2294, we did GHC tuning to add -I0 -qg (ref) but on instances with high memory and core count the throughput doesn't really scale.
The RTS page suggests tuning -A and -n:
This is particularly useful in conjunction with larger -A values, for example -A64m -n4m is a useful combination on larger core counts (8+). https://ghc.gitlab.haskell.org/ghc/doc/users_guide/runtime_control.html#rts-flag-n-size
So given that, we run some combinations of different RTS settings (ref) to see what increases throughput.
We use this command from postgrest-benchmark:
postgrest-bench-vary-high-instances \
postgrest-bench-vary-rts \
postgrest-bench-k6 100 k6/GETSingleJWT.js 2m \
> GETSingle.txtThis takes a while and at the end it produces GETSingle.txt. The summary:
| EC2 instance | default | -A32m -n2m |
-A64m -n4m |
-A128m -n8m |
-A256m -n8m |
-N16 -A64m -n4m |
-N32 -A128m -n8m |
-N32 -qn16 -A128m -n8m |
-N32 -qn16 -A256m -n8m |
-N32 -qb -A128m -n8m |
-N32 -qb -qn16 -A256m -n8m |
|---|---|---|---|---|---|---|---|---|---|---|---|
m5a.8xlarge |
7727.860928/s | 9522.679781/s | 10132.430738/s | 9737.286311/s | 9064.729497/s | 6305.888906/s | 9407.80029/s | 9700.614549/s | 9375.080221/s | 9678.518248/s | 9283.864351/s |
m5a.12xlarge |
8393.9911/s | 10093.215626/s | 10429.883134/s | 10032.421638/s | 8932.726338/s | 5830.565426/s | 9492.462763/s | 10114.899447/s | 8636.548909/s | 8807.67847/s | 8641.801368/s |
m5a.16xlarge |
7855.542472/s | 9457.425193/s | 10315.556771/s | 10370.231374/s | 11100.838817/s | 5926.925714/s | 8636.821513/s | 8815.990632/s | 8504.223995/s | 8772.061313/s | 8691.308632/s |
So the default has worse throughput than just some low values of -A and -n.
Source: PostgREST/postgrest