Skip to content

Implement next-gen APC storage engine (APCng) #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 5, 2021

Conversation

thedeacon
Copy link
Contributor

This PR deprecates the older PR #37 and solves Issue #36 . It also fixes a few places where Issue #27 can crop up, for instance if an APC value is deleted by another process at just the right moment, the APC engine would spin forever waiting for apcu_cas to succeed - this solves the problem by limiting the number of iterations we will wait.

README.APCng.md includes detailed benchmarking results comparing the original APC engine vs this new APCng engine, as requested by @LKaemmerling . Also as requested, this is implemented as a new Storage engine type, since the storage format is not compatible. Either the APC or APCng engine may be employed by users, both are currently treated equally and APC remains unchanged.

I put a fair amount of effort into a semi-automated performance-test "mini suite", including some assertions around performance of APCng relative to APC (basically: it should be much faster for collect() calls, and approximately the same speed for all other calls to the storage layer). This "Performance" PHPUnit group is excluded by default, since it takes many minutes to complete, but the README files include instructions on how to run this test suite. PHPUnit isn't the best tool for the job, but I do like the ability to make assertions about relative performance, and it beats trying to write up my own test harness and make it work cross-platform.

By comparing the src/Prometheus/Storage/APCng.php with the APC.php from #37 , one can see the overall structure of the engine is very similar, so most of the comments from that PR about the storage structure and function are still relevant. However, a few changes have been made to improve stability and speed, and remove complex code that offers little actual performance increase, based on real-world experience in our production environment. See README.APCng.md for a more-detailed description of how the engine works.

I am happy to answer questions or respond/engage in any other ways needed for anyone reviewing this PR, just let me know!

Copy link
Member

@LKaemmerling LKaemmerling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @thedeacon,

wow that is a really great contribution! Never had such a detailed description. From my perspective everything looks fine, I just have 2 smaller things. Really great and awesome job!

@thedeacon
Copy link
Contributor Author

Thank you for the kind words, @LKaemmerling! I've fixed up the two items you pointed out.

@LKaemmerling LKaemmerling enabled auto-merge (squash) November 5, 2021 05:53
@LKaemmerling
Copy link
Member

As i said really good job @thedeacon! A release with the new storage engine will follow asap! Good job!

@LKaemmerling LKaemmerling merged commit 7c998b3 into PromPHP:master Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants