<#631 feat: improve performance of matrix when mul...
# pact-broker
g
#631 feat: improve performance of matrix when multiple selectors are specified Pull request opened by bethesque This PR is practically un-reviewable, as I have re-written and refactored large chunks of the matrix code, for both performance and readability reasons. It had to be done however, and I'm pleased with the results. Things worth noting: Performance optimisation • To reproduce the performance issues we have in prod on my local machine, I had to use a postgres docker container with
--cpu-period=100000 --cpu-quota=50000
, because my dev machine has way more CPU than our prod database, and the queries would otherwise run practically instantaneously. • For the very large tenant dataset that was causing us problems recently • calculating the integrations has been reduced from 26 seconds to a few hundred milliseconds • performing the actual matrix query has been reduced from 26 seconds to 4 seconds • the overall time has been reduced from almost a minute to 5 seconds • there may be further possibility for optimisation, but it will be diminishing returns Refactoring • The very large PactBroker:Matrix:Repository class has had its logic split up into a bunch of smaller, single purpose classes that are hopefully much more understandable. • Despite the large number of production code changes, there was only one change required in in the test code, and the matrix query code is the most thoroughly tested piece of code in the project, so I'm as confident as I can be that I have not introduced any bugs. pact-foundation/pact_broker GitHub Actions: mysql GitHub Actions: mysql ✅ 17 other checks have passed 17/19 successful checks
🎉 1