Blog

PHP Benchmark: include() vs file_get_contents()

TLDR: include() can be significantly faster than file_get_contents(), if certain conditions are met. I’m building a simple page caching plugin to ship with Sail CLI for WordPress. I’ve already decided that the filesystem is going to be the primary storage method and ran some benchmarks against Redis and Memcached, the results were satisfying. However, even with just the filesystem...

Redis vs Memcached vs file_get_contents

I read articles about web performance and scaling almost every day, and when it comes to caching, the vast majority of them promote tools like Redis and Memcached, which are really fast, in-memory key-value stores. Their performance metrics, the requests per second, how easy it is to scale them and all their great features, will often overshadow the fact that these are services designed to run on...

Page Caching on the Filesystem

A few months ago I set out to build a page caching plugin for WordPress from scratch and streamed it live. The result was a simple filesystem-based advanced-cache.php implementation. It was nowhere near perfect, but it worked. It worked so well, that I decided to put some more effort into it, and I’m happy to report that it’s been running successfully on some production sites...

Sender header with wp_mail()

I was playing around with my Postfix configuration, trying to get a setup working with multiple different domains. My goal was to be able to use a different relay host and authentication, based on the sender’s address in the message. This turned out to be quite a simple solution — there’s a Postfix configuration setting called sender_dependent_relayhost_maps, which does exactly...

Cache Invalidation with Flags

Cache invalidation is hard, proven times and times by the “clear cache” and “delete all caches” buttons in various caching plugins and hosting control panels. While some of the concepts in this post are applicable to various types of caching, I’ll stick to page caching for simplicity, and of course WordPress.

WordPress Performance Profiling with Sail CLI

Having to deal with performance problems on a WordPress site is never too pleasant, partly because the tooling is not great. Things like Query Monitor and the Debug Bar series of plugins can certainly help to some extent, but often times they’re not enough, because they do things in PHP, which is limited to, well… PHP. Moreover, when reporting on database queries or remote HTTP...

wp_mail() is NOT broken

So why is everybody trying to fix it? I’ll try to explain. A few of months ago I started working on a new open source project called Sail, which is a CLI tool to provision WordPress servers on DigitalOcean. I wanted the best possible e-mail configuration I could have, fully transparent to the WordPress user, so I did some research. A lot of research actually. The first thing I noticed, is...

Configuring Mailgun for WordPress with Sail CLI

Mailgun is a robust e-mail delivery service with both API and SMTP support, and a generous trial of up to 5000 e-mails/mo for three months. Together with Mailgun, we’ve developed a couple of default blueprints for Sail to ease the configuration. mailgun-dns.yaml: this blueprint adds all necessary DNS records for mail delivery through Mailgun, as well as domain verification at Mailgunmailgun...

Fun with Blueprints in Sail CLI for WordPress

Blueprints allow Sail users to define an environment, where their WordPress applications will be provisioned. Currently blueprints support plugins (wp.org or custom), themes, options and wp-config.php constants. In future updates we’ll add support for Redis/Memcached setups, Mail, security (fail2ban, etc.) and much more. Possibly some DigitalOcean features too, like floating IPs and volumes...