Closed stijn-devriendt closed 4 years ago
I'm surprised the text formatting is taking that long. Do you have some measurements? Is this taking significantly longer than ordinary delays (e.g. due to GC)?
We haven't done any measurements. However, with our I/O-heavy application we have seen things like parsing and generation of data cause significant scheduling delays for I/O-bound lwt tasks.
I've observed ~300KiB/metrics-request at some point while we've seen visible user-impact while parsing or generating around 1-1.5MiB.
Instead of fixing the generation immediately, I might add a couple of metrics around the generation (as I've seen the go client do IIRC) to get an idea of the actual CPU-time it consumes.
Closing this for now. Please reopen if it turns out to be an actual problem.
Because the text formatter is Lwt unaware, containing no Lwt.yield's or other Lwt functions that may block, the HTTP GET may cause starvation of I/O. It probably makes sense to add yield's every now and then, such that an I/O-heavy application doesn't get starved by these CPU-heavy operations.