I’m debugging an issue, and I think the cause is a single lambda trying to read far too much data from one location at once. The details aren’t super important.
The part I’m interested in is that we do reads in a utility with concurrency X. This makes sense. Somewhere else in the codebase we do an operation with concurrency Y, which in certain cases can call this utility. In local context this is fine, but the global impact of it is that we can make up to X * Y reads simultaneously, which is bad.
I can solve the immediate problem fine. At a larger scale, what languages/libraries/patterns would prevent this? I’d like to say “use up to X concurrency here, up to Y concurrency there, but never use more than Z concurrency when reading from this specific system”.
This feels like something that #StructuredConcurrency would address? Is that the case, and are there other approaches?
#programming #nodejs