Skip to main content

How it works

How a server-side web optimizer works

The docs tell you which directives to set; the blog covers what to fix on a given stack. These are the explainers in between — how the optimization actually works under the hood. The techniques trace back to the open-source mod_pagespeed and ngx_pagespeed projects, which We-Amp helped build and maintain; mod_pagespeed carries them forward in both of its parts — the module and the optimizer worker.

How a server optimizer avoids adding latency

How mod_pagespeed optimizes images, CSS, and JS without slowing the request: the second-request problem, and the optimizer worker that solves it.

Read it

How the metadata cache avoids re-optimizing

How mod_pagespeed avoids re-optimizing on every request: a metadata cache keyed by the output URL maps to the answer and skips rewrites that don't shrink.

Read it

How CSS minification and URL rewriting work

How mod_pagespeed parses CSS into a syntax tree to minify, rewrite url(), and flatten @import safely — and why regex rewriters corrupt stylesheets.

Read it

For the full list of what gets rewritten, see the feature list; for fixes by platform, see the blog; for what a server can and cannot automate, see PageSpeed optimization.

Run it: the mod_pagespeed docs cover both parts — the in-process module for Apache, nginx and IIS, and the optimizer worker that does the heavy optimization off the request path.

Measuring your own pages? Test a page and map every failing audit to its fix, or read what LCP, CLS, and INP mean.

Search