Skip to content
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

Make the static cache persist for the entire life of the PHP process, to reduce HTTP requests for unmodified metadata #120

Merged
merged 6 commits into from
Jul 15, 2024

Conversation

phenaproxima
Copy link
Collaborator

@phenaproxima phenaproxima commented Jul 13, 2024

Hey, look! I found a way to reduce the number of network requests we make. :) This makes the static cache loader more aggressive, and persists it for the entire life of the PHP process, regardless of how often Composer decides to reset itself internally.

Testing with php-tuf/drupal-project doesn't show a major performance difference, but this definitely reduces the amount of network-bound I/O, which is certainly good. You can tell by comparing the logs -- testing against this branch, you'll see far fewer requests for TUF metadata that return a 304 response code.

@phenaproxima phenaproxima requested a review from tedbow July 13, 2024 02:01
@@ -0,0 +1,24 @@
<?php

$file = __DIR__ . $_SERVER['SCRIPT_NAME'];
Copy link
Collaborator Author

@phenaproxima phenaproxima Jul 13, 2024

Choose a reason for hiding this comment

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

This file was added to support the functional testing. PHP's built-in server doesn't natively handle If-Modified-Since headers, so I had to implement that here.

@phenaproxima
Copy link
Collaborator Author

@tedbow is on another project, so I'm merging this for now and he will review the changes before the next tag is cut.

@phenaproxima phenaproxima merged commit c1174e6 into main Jul 15, 2024
11 checks passed
@phenaproxima phenaproxima deleted the reduce-304 branch July 15, 2024 17:44
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.

1 participant