My slides from WordCamp Dhaka 2019 on WordPress Scaling. In this session I explained performance optimisation using HTTP/2, Caching and compressing resources.
I also explained how to Dockerize WordPress to make it easier to scale.
7. Decreases & Compresses
Headers
Decreases the amount
Of open connection.
Reduces to 1
Server can push
Necessary files
beforehand
Fully Backward
Compatible
You should really go HTTP/2 because
9. Enabling HTTP/2 in Apache
Step 1 : Enable HTTP/2 Module in Apache
Sudo a2enmod http2
sudo apachectl restart
Step 2 : Configure The web server to use HTTP2
<VirtualHost *:443>
Protocols h2 http/1.1
ServerAdmin you@your-awesome-site.com
ServerName your-awesome-site.com
...
</VirtualHost>
10. Facts
• Most CDN and Specialized File cloud comes with HTTP/2 pre enabled
like, Amazon S3, google Cloud Storage and most others have option to
enable it.
• HTTP/2 must be served over HTTPS. Otherwise most browsers will ignore
it.
• HTTP/2 will not fix your bad code.
19. Small Things matter
• Use SVG for logo and icons (Avoid icon fonts if not needed)
• Use JPG images instead of png. JPG has a better compression
• Use a CSS processor to clean up your CSS file
32. • WordPress application
• PHP
• All required PHP extensions
• Web Server (In many cases)
• Default Plugins and themes
• A database
• A way to add own plugin and themes
• A way to back up/keep all the file changes
• A way to access WordPress from outside
• This point is here to fix alignment in slide.
What’s Available? What else do we need?
34. Image with Tag
For Themes and plugins
Localhost:8080
Database Settings
Name of the database service
Service for the Database, Mysql
Persistent data in database
41. Or simply by adding multiple
services with Compose
42. Things to remember
• Use cloud native solutions if possible, for example if you are using AWS or
GCP, use their database solution. That’s much easier to scale.
• Use Sticky Session (IP hash) for load balancers, Otherwise PHP session
will be lost
• It’s better to create many smaller instances rather than one gigantic
instance. It will be less prone to failure