SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
Scaling WordPress
Handling the bittersweet pain of success
All the photos used are from Unsplash
Principal Software Engineer, Telenor Health
Anam Ahmed
@theanam
Efficient Use of existing
Resources
When and how
To increase resource
Finding points of improvement
Static Resources
HTTP/2
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
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.com;
root /path/to/public;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/private.key;
ssl_protocols TLSv1.2;
}
Enabling HTTP/2 in Nginx
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>
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.
Compression
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
gzip on;
gzip_disable “msie6”;
gzip_proxied any;
server_name example.com;
root /path/to/public;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/private.key;
ssl_protocols TLSv1.2;
}
Enabling gzip Compression in Nginx
Enabling gzip in Apache
Step 1 : Enable deflate Module in Apache
Sudo a2enmod deflate
sudo apachectl restart
Step 2 : Configure The web server to use gzip compression
<Directory /var/www/html/>
<IfModule mod_mime.c>
AddType application/x-javascript .js
AddType text/css .css
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/plain text/xml application/
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
</IfModule>
</IfModule>
Header append Vary User-Agent env=!dont-vary
</Directory>
[Too Big for the slide]
Help your browser cache better
Send proper cache-control headers
Cache-Control on nginx
location ~* .(?:manifest|appcache|html?|xml|json)$ {
expires -1;
}
# Media: images, icons, video, audio, HTC
location ~* .(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* .(?:css|js)$ {
expires 1y;
add_header Cache-Control "public";
}
Apache?
You already know the drill
What else can we do?
Google PageSpeed module ✨
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
Where to measure progress?
Google Pagespeed Insight
What does performance have to
do with Scaling?
If your web application is efficient
You’ll be able to serve more users
With the same resource.
- It’s true but nobody quoted it
Dynamic Contents
Let’s Dockerize 🐳
What’s the Advantage?
• Easy to spawn multiple instances

• Easy to shift

• Easy to update core

• Easy to develop

• Easy to deploy
Official WordPress Docker Image
Before we start, Let’s think like
Docker 🚀
• 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?
Introducing Docker Compose
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
Docker-compose up -d
Grab a cup of ☕ while it finishes its work
http://localhost:8080
All the default themes
and plugins will be
automatically
populated in the
folders we created
http://bit.ly/wordcamp-compose
So, How do we scale with
Docker?
With These tools
Or simply by adding multiple
services with Compose
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
There’s A lot to talk about
Scaling
But Maybe some other day.
Thank you.

Weitere ähnliche Inhalte

Was ist angesagt?

Speed Up WordPress Websites - Part 1 - WordPress Cairo Meetup
Speed Up WordPress Websites - Part 1 - WordPress Cairo MeetupSpeed Up WordPress Websites - Part 1 - WordPress Cairo Meetup
Speed Up WordPress Websites - Part 1 - WordPress Cairo MeetupAhmed Mohammed Nagdy
 
Adobe CQ5 for Developers - Introduction
Adobe CQ5 for Developers - IntroductionAdobe CQ5 for Developers - Introduction
Adobe CQ5 for Developers - IntroductionTekno Point
 
Care and feeding notes
Care and feeding notesCare and feeding notes
Care and feeding notesPerrin Harkins
 
Introdcution to Adobe CQ
Introdcution to Adobe CQIntrodcution to Adobe CQ
Introdcution to Adobe CQRest West
 
WordPress Meetup 17th Oct, 2015 at TechHub (ASTP) Lahore, Pakistan
WordPress Meetup 17th Oct, 2015 at TechHub (ASTP) Lahore, PakistanWordPress Meetup 17th Oct, 2015 at TechHub (ASTP) Lahore, Pakistan
WordPress Meetup 17th Oct, 2015 at TechHub (ASTP) Lahore, PakistanFahad Mahmood
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on SteroidsSiteGround.com
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPressBarry Abrahamson
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APCBen Ramsey
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPressvnsavage
 
High Performance WordPress II
High Performance WordPress IIHigh Performance WordPress II
High Performance WordPress IIBarry Abrahamson
 
ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007Barry Abrahamson
 
How to cache your static resources
How to cache your static resourcesHow to cache your static resources
How to cache your static resourcesWesley Smits
 
Reducing latency on the web with the Azure CDN - DevSum - SWAG
Reducing latency on the web with the Azure CDN - DevSum - SWAGReducing latency on the web with the Azure CDN - DevSum - SWAG
Reducing latency on the web with the Azure CDN - DevSum - SWAGMaarten Balliauw
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Reducing latency on the web with the Azure CDN- TechDays NL 2014
Reducing latency on the web with the Azure CDN- TechDays NL 2014Reducing latency on the web with the Azure CDN- TechDays NL 2014
Reducing latency on the web with the Azure CDN- TechDays NL 2014Maarten Balliauw
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!WordCamp Cape Town
 
How to reduce database load using Memcache
How to reduce database load using MemcacheHow to reduce database load using Memcache
How to reduce database load using Memcachevaluebound
 
Sofia WP User Group Presentation
Sofia WP User Group PresentationSofia WP User Group Presentation
Sofia WP User Group PresentationDaniel Kanchev
 
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...OVHcloud
 

Was ist angesagt? (20)

Speed Up WordPress Websites - Part 1 - WordPress Cairo Meetup
Speed Up WordPress Websites - Part 1 - WordPress Cairo MeetupSpeed Up WordPress Websites - Part 1 - WordPress Cairo Meetup
Speed Up WordPress Websites - Part 1 - WordPress Cairo Meetup
 
Adobe CQ5 for Developers - Introduction
Adobe CQ5 for Developers - IntroductionAdobe CQ5 for Developers - Introduction
Adobe CQ5 for Developers - Introduction
 
Care and feeding notes
Care and feeding notesCare and feeding notes
Care and feeding notes
 
Introdcution to Adobe CQ
Introdcution to Adobe CQIntrodcution to Adobe CQ
Introdcution to Adobe CQ
 
WordPress Meetup 17th Oct, 2015 at TechHub (ASTP) Lahore, Pakistan
WordPress Meetup 17th Oct, 2015 at TechHub (ASTP) Lahore, PakistanWordPress Meetup 17th Oct, 2015 at TechHub (ASTP) Lahore, Pakistan
WordPress Meetup 17th Oct, 2015 at TechHub (ASTP) Lahore, Pakistan
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
High Performance WordPress II
High Performance WordPress IIHigh Performance WordPress II
High Performance WordPress II
 
ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007
 
How to cache your static resources
How to cache your static resourcesHow to cache your static resources
How to cache your static resources
 
Reducing latency on the web with the Azure CDN - DevSum - SWAG
Reducing latency on the web with the Azure CDN - DevSum - SWAGReducing latency on the web with the Azure CDN - DevSum - SWAG
Reducing latency on the web with the Azure CDN - DevSum - SWAG
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Reducing latency on the web with the Azure CDN- TechDays NL 2014
Reducing latency on the web with the Azure CDN- TechDays NL 2014Reducing latency on the web with the Azure CDN- TechDays NL 2014
Reducing latency on the web with the Azure CDN- TechDays NL 2014
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!
 
How to reduce database load using Memcache
How to reduce database load using MemcacheHow to reduce database load using Memcache
How to reduce database load using Memcache
 
Sofia WP User Group Presentation
Sofia WP User Group PresentationSofia WP User Group Presentation
Sofia WP User Group Presentation
 
Scalable talk notes
Scalable talk notesScalable talk notes
Scalable talk notes
 
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
 

Ähnlich wie WordPress At Scale. WordCamp Dhaka 2019

Rock Solid WordPress
Rock Solid WordPressRock Solid WordPress
Rock Solid WordPressErik Osterman
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and ScalabilityMediacurrent
 
Using MAMP for Web Development
Using MAMP for Web DevelopmentUsing MAMP for Web Development
Using MAMP for Web DevelopmentEric Greene
 
Drupal performance optimization Best Practices
Drupal performance optimization Best PracticesDrupal performance optimization Best Practices
Drupal performance optimization Best PracticesRatnesh kumar, CSM
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuis Rodríguez Castromil
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.DrupalCampDN
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAndrew Khoury
 
WordPress MU 101
WordPress MU 101WordPress MU 101
WordPress MU 101Pete Mall
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax ApplicationsSiarhei Barysiuk
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...Otto Kekäläinen
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeededm00se
 
Magento Performance Optimization 101
Magento Performance Optimization 101Magento Performance Optimization 101
Magento Performance Optimization 101Angus Li
 
Drupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal ConceptsDrupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal ConceptsMicky Metts
 
I Can Haz More Performanz?
I Can Haz More Performanz?I Can Haz More Performanz?
I Can Haz More Performanz?Andy Melichar
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Studyhernanibf
 
Mastering WordPress Vol.1
Mastering WordPress Vol.1Mastering WordPress Vol.1
Mastering WordPress Vol.1Wataru OKAMOTO
 

Ähnlich wie WordPress At Scale. WordCamp Dhaka 2019 (20)

Caching 101
Caching 101Caching 101
Caching 101
 
Rock Solid WordPress
Rock Solid WordPressRock Solid WordPress
Rock Solid WordPress
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and Scalability
 
Using MAMP for Web Development
Using MAMP for Web DevelopmentUsing MAMP for Web Development
Using MAMP for Web Development
 
Drupal performance optimization Best Practices
Drupal performance optimization Best PracticesDrupal performance optimization Best Practices
Drupal performance optimization Best Practices
 
Optimize wordpress
Optimize wordpressOptimize wordpress
Optimize wordpress
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser Caching
 
WordPress MU 101
WordPress MU 101WordPress MU 101
WordPress MU 101
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Magento Performance Optimization 101
Magento Performance Optimization 101Magento Performance Optimization 101
Magento Performance Optimization 101
 
Drupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal ConceptsDrupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal Concepts
 
Drupal development
Drupal development Drupal development
Drupal development
 
I Can Haz More Performanz?
I Can Haz More Performanz?I Can Haz More Performanz?
I Can Haz More Performanz?
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Study
 
Mastering WordPress Vol.1
Mastering WordPress Vol.1Mastering WordPress Vol.1
Mastering WordPress Vol.1
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 

Kürzlich hochgeladen (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

WordPress At Scale. WordCamp Dhaka 2019

  • 1. Scaling WordPress Handling the bittersweet pain of success All the photos used are from Unsplash
  • 2. Principal Software Engineer, Telenor Health Anam Ahmed @theanam
  • 3. Efficient Use of existing Resources When and how To increase resource
  • 4. Finding points of improvement
  • 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
  • 8. server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.com; root /path/to/public; ssl_certificate /path/to/certificate.crt; ssl_certificate_key /path/to/private.key; ssl_protocols TLSv1.2; } Enabling HTTP/2 in Nginx
  • 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.
  • 12. server { listen 443 ssl http2; listen [::]:443 ssl http2; gzip on; gzip_disable “msie6”; gzip_proxied any; server_name example.com; root /path/to/public; ssl_certificate /path/to/certificate.crt; ssl_certificate_key /path/to/private.key; ssl_protocols TLSv1.2; } Enabling gzip Compression in Nginx
  • 13. Enabling gzip in Apache Step 1 : Enable deflate Module in Apache Sudo a2enmod deflate sudo apachectl restart Step 2 : Configure The web server to use gzip compression <Directory /var/www/html/> <IfModule mod_mime.c> AddType application/x-javascript .js AddType text/css .css </IfModule> <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/plain text/xml application/ <IfModule mod_setenvif.c> BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html </IfModule> </IfModule> Header append Vary User-Agent env=!dont-vary </Directory> [Too Big for the slide]
  • 14. Help your browser cache better Send proper cache-control headers
  • 15. Cache-Control on nginx location ~* .(?:manifest|appcache|html?|xml|json)$ { expires -1; } # Media: images, icons, video, audio, HTC location ~* .(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { expires 1M; add_header Cache-Control "public"; } # CSS and Javascript location ~* .(?:css|js)$ { expires 1y; add_header Cache-Control "public"; }
  • 17. What else can we do?
  • 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
  • 20. Where to measure progress?
  • 22.
  • 23.
  • 24.
  • 25. What does performance have to do with Scaling?
  • 26. If your web application is efficient You’ll be able to serve more users With the same resource. - It’s true but nobody quoted it
  • 29. What’s the Advantage? • Easy to spawn multiple instances • Easy to shift • Easy to update core • Easy to develop • Easy to deploy
  • 31. Before we start, Let’s think like Docker 🚀
  • 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
  • 35. Docker-compose up -d Grab a cup of ☕ while it finishes its work
  • 37. All the default themes and plugins will be automatically populated in the folders we created
  • 39. So, How do we scale with Docker?
  • 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
  • 43. There’s A lot to talk about Scaling
  • 44. But Maybe some other day.