Lower stack chunk size in RTS to reduce thread STACK memory (closes #5190)

This reduces memory consumption for new idle subscriptions significantly
(see linked ticket).

The hypothesis is: we fork a lot of threads per websocket, and some of
these use slightly more than the initial 1K stack size, so the first
overflow balloons to 32K, when significantly less is required.

However: running with `+RTS -K1K -xc` did not seem to show evidence of
any overflows! So it's a mystery why this improves things.

GHC should probably also be doubling the stack buffer at each overflow
or doing something even smarter; the knobs we have aren't so helpful.
This commit is contained in:
Brandon Simmons 2020-06-23 20:35:36 -04:00
parent f6d111ccd9
commit f9b5b8382c
2 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,7 @@
(Add entries here in the order of: server, console, cli, docs, others)
- server: improve memory usage of idle websockets connections (#5190)
- server: few relay fixes (fix #5020, #5037, #5046) (#5013)
- server: raise error on startup when `--unauthorized-role` is ignored (#4736)
- server: fix bug which arises when renaming/dropping a column on a remote relationship (#5005, #5119)

View File

@ -48,7 +48,11 @@ common common-exe
-- limiting the parallel GC to 2 or 3 capabilities as a very conservative choice, since more
-- than that is highly unlikely to ever be helpful. More benchmarking would be useful to know if
-- this is the right decision. Its possible it would better to just turn it off completely.
"-with-rtsopts=-N -I2 -qn2"
--
-- `-kc8K` helps limit memory consumption in websockets (perhaps elsewhere) by making the
-- cost of a thread's first (and probably only) stack overflow less severe.
-- See:https://github.com/hasura/graphql-engine/issues/5190
"-with-rtsopts=-N -I2 -qn2 -kc8K"
library
import: common-all