Limit number of the transformations threads#235
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
==========================================
+ Coverage 89.16% 89.34% +0.17%
==========================================
Files 6 6
Lines 674 685 +11
==========================================
+ Hits 601 612 +11
Misses 50 50
Partials 23 23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@googlebot I signed it! |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
Hey @striker2000, thanks for this patch! Sorry it's taken a couple of week to get back to you. I think this is certainly a good approach; my only reservation is about where exactly inside of Does that make sense? |
|
We're seeing fairly frequent OOM's (~10 a day) which are likely related to transformations. Is anyone using this patch successfully? |
|
@mdkent thsi PR has a problem with inflight request. I have updated with the current main branch and this PR. https://github.com/Jorgevillada/imageproxy Some request never finish. |


When a search bot requests many images at the same time and these images are not in the cache, all transformation goroutines start in parallel causing the huge memory allocation, that leads to the termination of the process by OOM.
This fix is adding the limiter in the
TransformingTransportthat limits the number of running transformation threads to the number of logical CPUs. The metrichttp_requests_in_flightis adding as well to monitor the length of the requests queue.Fixes #200.