# Summary

Boost provides static page caching for Drupal enabling a very significant performance and scalability boost for sites that receive mostly anonymous traffic. For shared hosting this is your best option in terms of improving performance. On dedicated servers, you may want to consider Varnish instead.

# Project URL

https://www.drupal.org/project/boost

# Where is the code?

Unknown

# Estimated completion date

Unknown

# Dependencies

Unknown

# Who's doing the port?

Unknown

# What help do they need?

Unknown

# D8 roadmap

https://www.drupal.org/node/2009898

# Background and reference information

Unknown

Comments

legaudinier created an issue.

bojanz’s picture

Doesn't dynamic_page_cache in core basically make boost obsolete?

geerlingguy’s picture

@bojanz - I don't think the dynamic_page_cache bypasses PHP entirely. Boost makes it possible to basically run an entire Drupal site with Apache and no PHP overhead. I use it a lot less nowadays, since Nginx and Varnish are so much nicer/easier to set up for static caching, but it still has it's place. D8 has made great strides, though, and it might be enough for some people to not consider Boost anymore.

Wim Leers’s picture

@geerlingguy is mostly correct.

I don't think Dynamic Page Cache is even relevant here. Boost is about serving static HTML to anonymous users. So Page Cache is the correct comparison here. And D8 ships with Page Cache enabled by default, so indeed for many sites Boost will no longer be necessary: Page Cache will be enough.

But, because Boost caches to disk and uses Apache rewrite rules rather than Page Cache's caching to a cache backend (usually database) using PHP, Boost still can make sense.

Boost in D8 should probably disable Page Cache's middleware in D8, because when you use Boost, it's pointless to also use Page Cache. OTOH, I don't know how well Boost handles session cookies, so maybe that's a bit premature.

GaëlG’s picture

@wimleers - then shouldn't the new Boost just set a file cache backend for Page cache?

Wim Leers’s picture

@GaëlG, no, again, Boost allows you to serve static HTML directly from Apache. i.e. zero PHP executed. A File cache back-end for the Page Cache does still execute PHP.

littledynamo’s picture

I came across a D8 version of boost on Github - https://github.com/swim/boost. No Apache config yet though.

joseph.olstad’s picture

Would be nice to have this in D8 at some point although we're not switching to D8 yet.

For D7, we LOVE boost to cache json (ajax) and pages, we've perfected our rewrite rules and regex so that it works extremely well and we also created a module called boost_blast to make sure that the caches are completely cleared when we want them to be. Our site is pretty small, only about 20000 pages.

Here is our rewriteRules (for IIS) , eventually we'll switch to Apache or nginx

        <rule name="Boost json" enabled="true" stopProcessing="true">
            <match url=".*" ignoreCase="false" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                <add input="{URL}" pattern="(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                <add input="{DOCUMENT_ROOT}/sites/default/files/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.json" matchType="IsFile" />
            </conditions>
            <serverVariables>
                <set name="CONTENT_TYPE" value="application/json" /> <!-- text/javascript -->
            </serverVariables>
            <action type="Rewrite" url="sites/default/files/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.json" />
        </rule>
        <rule name="Boost html" enabled="true" stopProcessing="true">
                <match url=".*" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                        <add input="{URL}" pattern="\.(jpe?g|gif|png)$" negate="true" />
                        <add input="{URL}" pattern="(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                        <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                        <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                        <add input="{DOCUMENT_ROOT}/sites/default/files/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.html" matchType="IsFile" />
                </conditions>
                <serverVariables>
                        <set name="CONTENT_TYPE" value="text/html" />
                </serverVariables>
                <action type="Rewrite" url="sites/default/files/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.html" />
        </rule>

adding this to our rewrite rules was necessary:
<add input="{URL}" pattern="\.(jpe?g|gif|png)$" negate="true" />

prevents jpeg/gif/png to be cached as html , happens when image styles are being processed and the server responds with text saying ("compiling image style please wait") instead of the image