-
Notifications
You must be signed in to change notification settings - Fork 64
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
Apache + PHP performance tuning #64
Conversation
…manual overrides as global vars * if no manual override, calculating php memory_limit via `shell` task * replacing apache default prefork config with include to separate file * generating prefork.conf from template (incl calculated directive values) * using custom `replace` module, see ansible/ansible#4889 Fixes #56
{% set apache_max_spare_servers = 10 if ansible_memtotal_mb >= 2048 else 3 %} | ||
{%- endif -%} | ||
{%- if apache_max_requests_per_child is undefined -%} | ||
{% set apache_max_requests_per_child = 1000 %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: as this has little to do with physical machine specs and more to do with bandwidth usage, I figured we can just plug in a sensible default value.
Confirmed expected behavior for: Slightly unexpected behavior for: At a guess, I think there's something off in the php |
Fixed for machines with > 2GB |
If there are no objections (pokes @ericclemmons), I'm planning to merge this for 0.2.29 |
Lots to go over here, but the only potential BC issue I'd have is with variable naming. Would it make sense to have groups, like seen here?
|
Here's an interesting pitfall: the vars defined in a role (eg, the So yeah...something to be aware of |
Oh, another one! If ansible finds two conflicting groups (python dicts under the hood), it replaces them rather than merging them. # With this in $REPO/provisioning/group_vars/webservers...
php_settings:
memory_limit: 320
# And this in $REPO/bower_components/genesis-wordpress/provisioning/roles/wordpress/vars/main.yml...
php_settings:
date_timezone: America/Chicago
# We end up losing the nested vars from group_vars. SURPRISE!
php_settings:
date_timezone: America/Chicago |
…ng settings from roles/wordpress/vars Note that template logic in prefork.conf is necessarily more complex (as we cannot assign to dicts), but also somewhat more explicit and less magical. I'm okay with this.
Confirmed expected behavior: |
Apache + PHP performance tuning
Php's memory_limit is calculated in a
command
task, and the rest are calculated in atemplate
of an apache include (implemented using a customreplace
module that's currently a PR for ansible core; see ansible/ansible#4889).The following global vars can be specified as manual overrides for above calculations:
php_settings.memory_limit
reserved_memory.mysql
reserved_memory.system
apache_settings.start_servers
apache_settings.min_spare_servers
apache_settings.max_spare_servers
apache_settings.max_clients
apache_settings.max_requests_per_child
Fixes #56