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

Thread safety #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Thread safety #16

wants to merge 2 commits into from

Conversation

phillipp
Copy link

@phillipp phillipp commented Dec 20, 2024

Description

Looking at #4 I wanted to take a stab at adding thread safety, because I didn't see a reason why it should not be possible to get it working.

Context / Why are we making this change?

When using Apache with mod_proxy for PHP-FPM or any other scripting language, threaded MPMs are a good fit. This pull request adds thread safety.

Testing and QA Plan

Reproducing the existing issues way easy enough (simply by using ab with high enough request concurrency). The code changes have been reviewed carefully and tested with the same scripts that triggered the errors before.

Impact

For any threaded and non-threaded MPM, there is an overhead because of the newly introduced mutex. In our test, it was still possible to achieve 16k req/s even with a prefork MPM on a single workstation.

The added thread safety and broader deployment range is worth it IMHO.

This adds a global mutex (which is not optimal, but for loads a
server handling dynamic content manageable) and a per-pool cache
for the resolved path. The document root is set per request
so no cleanup is needed anymore.

For sake of simplicity we decided not to got with double buffering
and removing the mutex was not worth it for now.
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