Skip to content

Apache + PHP memory usage tuning #56

@EvanK

Description

@EvanK

Though I don't know yet how we'll implement this, we'd like to — as part of the provisioning process — calculate a php memory_limit and several apache directives, based on the server's total RAM capacity.

Our target machine for a genesis install would have 2GB or more, while the local vagrant machine currently is allocated 1GB.

Note: I'm assuming #53 would mean Vagrant's memory usage would be negligible and roll into the overall system reserved memory.

First, we should calculate memory set aside for specific non-apache uses. I'm thinking the following:

  • System reserved memory: 512M for a machine with 2G or more, otherwise 1/4 of total system memory
  • MySQL reserved memory: 512M for a machine with 2G or more, otherwise 320M
  • PHP memory_limit: 256M for a machine with 2G or more, otherwise 128M

And apache-specific settings:

  • StartServers: 5 for a machine with 2G or more, otherwise 2
  • MinSpareServers: 5 for a machine with 2G or more, otherwise 2
  • MaxSpareServers: 10 for a machine with 2G or more, otherwise 3
  • MaxRequestsPerChild: Pulling a figure out of thin air, but I'm thinking 5000 should work?
  • MaxClients: the greater of these two:
    • ($TotalMemory - $ReservedSystemMemory - $ReservedMysqlMemory) / $PhpMemoryLimit
    • The number of vcpus the machine has

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions