Controlling parallelism of pipelines #151
-
We are running into an issue where we are running out of connections to our database. The specific error we are seeing is What happens is that we have custom shortcodes that make queries to the database. These shortcodes are included in the document content of which there are a large number of documents (200+). When the We will probably need to rethink how we do some things and try and pre-load the data required by the shortcodes so they don't do such a large number of queries, but for now, I just want to see if there are perhaps some switches we can toggle to "tone things down" a bit and get the Razor pages module to perhaps process each page in serial. I have tried the Is there anything you can advise us to do - other than rearchitecting our pipelines and loading data upfront? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I can think of a couple things you could try, but you’re correct that the optimal solution would be to pre-fetch data where you can really tailor the throttling. A lot of the modules have been designed to rip through work as fast as the internal Task thread pool will allow (independent of inter-pipeline parallelism as you noticed). For reference, the So here’s some options:
Let me know if you need more clarification on either of these ideas, and I’ll let you know if I come up with anything else. |
Beta Was this translation helpful? Give feedback.
I can think of a couple things you could try, but you’re correct that the optimal solution would be to pre-fetch data where you can really tailor the throttling. A lot of the modules have been designed to rip through work as fast as the internal Task thread pool will allow (independent of inter-pipeline parallelism as you noticed).
For reference, the
RenderRazor
module uses thisParallelSelectAsync
extension which boils down to a bunch ofTask.Run()
wrapped in aTask.WhenAll()
.So here’s some options:
SemaphoreSlim
. You should be okay on deadlock problems since Razor rendering doesn’…