Skip to content

Idle H2 threads don't terminate on "graceful" Apache restart (mpm_event) #212

@famzah

Description

@famzah

Vanilla Apache with "mpm_event" functions in the following way after a "graceful" restart:

  1. Old child processes which serve no requests are terminated immediately.
  2. Old child processes which have threads busy with existing requests are left alive. The busy threads continue to work until the requests are completed. The idle threads are terminated immediately.

This is an efficient way to handle "graceful" restarts because we can increase the ServerLimit a lot, in order to accommodate lots of old child processes (finishing a few old connections), and have a couple of up-to-date active child processes (with lots of threads waiting to serve new clients).

The old child processes allocate very few memory resources because most of their threads are terminated.

Unfortunately, mod_http2 doesn't honor the "graceful" restart. None of the following settings made any difference during my tests:

  1. H2MinWorkers 1 (additionally, I figured out that this isn't honored at all because a lot of H2 threads are always created, even for an idle Apache server which just started)
  2. H2MaxWorkerIdleSeconds 5 (the idle H2 thread live forever regardless of this setting combined with H2MinWorkers 1)

The old Apache child processes keep all their H2 threads active forever, regardless of the fact that most of those H2 threads are idle. I will appreciate it if you can look into this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions