SlideShare a Scribd company logo
Silverstripe at scale - design & architecture for silverstripe applications
Design & Architecture for Silverstripe applications
Silverstripe at Scale
About me
Brett Tasker
Principal Platform Engineer & Security
Specialist at Silverstripe Ltd.
You may recognize me from...
● Silverstripe Docker images
(brettt89/silverstripe-web)
● How to build a local development
environment (blog)
● Garbage Collection module (module)
● Community Slack (Brett Tasker)
Overview
● Introduction
● Architecture
● Performance
● Code Design
● Wrapping it up
Scalability is the property of a system to
handle a growing amount of work by adding
resources to the system.
- Wikipedia
“
”
Scalability Dimensions
Introduction
Administrative
Functional
Geographic
Load
Generation
Heterogeneous
Infrastructure
Load Balanced
Architecture & Design
Microservices
Architecture & Design
Web Servers
● Apache Module
● Fork Driven
● Memory Usage
● Easy Setup
mod_php
PHP Handlers
● Separate Process
● FastCGI
● Event Driven
● FPM
FastCGI / FPM
PHP Handlers
Performance
Resource Relationships
Performance
● PHP executions are single threaded
● Each PHP execution can only use a single core
● Cores vs Frequency
● Webserver services are multi-threaded
● Database services are multi-threaded
● Microservice Architecture
CPU performance
Silverstripe at scale - design & architecture for silverstripe applications
PHP APCu
● User cache
● Code Controlled
● Included in Silverstripe CMS
● Local shared memory
● Default shm size 32M
OPCache
● Bytecode cache
● Built into PHP Engine
● Stores precompiled PHP
● Included in Silverstripe CMS
● Local shared memory
● No Garbage Collection
● Restart = Rebuild of cache
Redis
● User cache
● Key Value store
● TCP / Shared
● Application
Memcached
● User cache
● Key Value store
● TCP / Shared
● Application
Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applications
InnoDB
● Table & Index data cache
● Buffers & Flushing
● Buffer Pool
○ Lookups
○ 60%-80% RAM
● Log Buffer
○ Transactions
● Log File
Silverstripe at scale - design & architecture for silverstripe applications
Query Caching
● Result set cache
● Deterministic Queries
● Does not support:
○ Subqueries
○ Temporary Tables
● Larger != Better
Silverstripe at scale - design & architecture for silverstripe applications
● Assets module requires .htaccess
● Does not work OOTB with Nginx
● SS_PROTECTED_ASSETS_PATH
Apache Dependency
● Used by default for CMS
● Adds _Versions tables for each DataObject
● Manipulates SELECT queries to JOIN _Versions
● Uses subqueries
● No Garbage Collection
● Only use what you need
● Consider disabling Versioning on DataObjects
Versioned module
● Dynamic generation of SQL queries
● Many_many relationships
● Subqueries / Large datasets
● Multiple smaller ORM executions
ORM Queries
● Single DB connection per PHP execution
● PHP concurrency == DB concurrency
● Low Database connections is bad
● Resource stampede
● DB Connection closes at end of PHP execution
Database Connections
● HTML & Parameter Substitution
● Often large cache datasets
● Not suitable for In-Memory caching
● Filesystem caching works well
Partial Caching
Code Design
DefaultCacheFactory
● Filesystem
● APCu
● OPCache
● Chain Cache
Filesystem Caching
● Files on Disk
● Serialization & JSON format
● Filenames = Cache Key
● One cache object per file
● No Garbage Collection
APCu Caching
● Memory caching
● Silverstripe CMS uses ChainCacheAdapter for APCu
● Fallback to Filesystem caching through ChainCacheAdapter
● Cache writes are applied to all layers of ChainCacheAdapter
● Potential waste of resources OOTB
OPCache
● Memory caching (Bytcode cache)
● Uses Filesystem caching architecture
● PHP Arrays in .php files
● Uses PHP “Include” function for loading
● Stored in OPCache precompiled cache data
What user caching do I use?
DO NOT USE OPCACHE FOR USER CACHE
Load Balanced architecture
Multiple Cache Factories
Silverstripe CMS Optimizations
Purpose of Caching
● Reduce Expensive Operations
● Do you need to cache that data?
● DataObjects VS Array
● Cache keys
● Caching for Value
Code Duplication & Vendor Dependencies
● Composer autoloader
● All PSR-4 defined content is loaded by Autoloader
● Duplicated code
● Unused vendor dependencies
● Reduce vendor overhead for more resources
Generators & Looping
● Large Datasets
● Memory Exhaustion
● ORM does not use Generators by default
● getGenerator method is available on DataList (ORM)
● Yield helps reduce resources requirements
Unset vs Null
● PHP does have ‘true’ garbage collection
● Unset flags memory allocation for re-use
● Value setting requires adjustment of memory allocation
● Unset faster than setting to NULL
● Iterations / Loops
Unset vs Null
Wrapping Up
Summary
● Load Balanced / Microservices
● Mod_php VS FastCGI
● Resource Relationships
● Bottlenecks / Performance
● Balancing speed and resources
Thank you!

More Related Content

What's hot (19)

PPTX
ProxySQL for MySQL
Mydbops
 
PDF
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
Alkacon Software GmbH & Co. KG
 
PPT
MySQL HA Percona cluster @ MySQL meetup Mumbai
Remote MySQL DBA
 
PDF
ASP.NET Scalability - NxtGen Oxford
Phil Pursglove
 
PDF
ProxySQL - High Performance and HA Proxy for MySQL
René Cannaò
 
PPTX
Supercharge Application Delivery to Satisfy Users
NGINX, Inc.
 
PDF
Design a scalable site: Problem and solutions
Chau Thanh
 
PDF
Webinar slides: MySQL & MariaDB load balancing with ProxySQL & ClusterControl...
Severalnines
 
PDF
High Performance Java EE with JCache and CDI
Payara
 
PPTX
Glass fish performance tuning tips from the field
Payara
 
PDF
ProxySQL Tutorial - PLAM 2016
Derek Downey
 
PDF
JavaCro'14 - Using WildFly core to build high performance web server – Tomaž ...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PPTX
What's New in NGINX Plus R8
NGINX, Inc.
 
PDF
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
Severalnines
 
PDF
Evolution of DBA in the Cloud Era
Mydbops
 
PDF
Lcu14 Lightning Talk- NGINX
Linaro
 
PDF
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest
Lenz Grimmer
 
PDF
MySQL topology healing at OLA.
Mydbops
 
PPTX
Maximizing PHP Performance with NGINX
NGINX, Inc.
 
ProxySQL for MySQL
Mydbops
 
OpenCms Days 2014 - OpenCms cloud setup with the FI-TS
Alkacon Software GmbH & Co. KG
 
MySQL HA Percona cluster @ MySQL meetup Mumbai
Remote MySQL DBA
 
ASP.NET Scalability - NxtGen Oxford
Phil Pursglove
 
ProxySQL - High Performance and HA Proxy for MySQL
René Cannaò
 
Supercharge Application Delivery to Satisfy Users
NGINX, Inc.
 
Design a scalable site: Problem and solutions
Chau Thanh
 
Webinar slides: MySQL & MariaDB load balancing with ProxySQL & ClusterControl...
Severalnines
 
High Performance Java EE with JCache and CDI
Payara
 
Glass fish performance tuning tips from the field
Payara
 
ProxySQL Tutorial - PLAM 2016
Derek Downey
 
JavaCro'14 - Using WildFly core to build high performance web server – Tomaž ...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
What's New in NGINX Plus R8
NGINX, Inc.
 
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
Severalnines
 
Evolution of DBA in the Cloud Era
Mydbops
 
Lcu14 Lightning Talk- NGINX
Linaro
 
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest
Lenz Grimmer
 
MySQL topology healing at OLA.
Mydbops
 
Maximizing PHP Performance with NGINX
NGINX, Inc.
 

Similar to Silverstripe at scale - design & architecture for silverstripe applications (20)

ODP
Caching and tuning fun for high scalability
Wim Godden
 
PDF
Top ten-list
Brian DeShong
 
PPT
Top 10 Scalability Mistakes
John Coggeshall
 
PDF
Bottom to Top Stack Optimization with LAMP
katzgrau
 
PDF
Bottom to Top Stack Optimization - CICON2011
CodeIgniter Conference
 
PPT
Apache Con 2008 Top 10 Mistakes
John Coggeshall
 
ODP
Caching and tuning fun for high scalability @ PHPTour
Wim Godden
 
PDF
Qcon
adityaagarwal
 
PDF
Scaling PHP apps
Matteo Moretti
 
PPTX
EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...
Nexcess.net LLC
 
PDF
Php go vrooom!
Elizabeth Smith
 
PDF
Scaling with Symfony - PHP UK
Ricard Clau
 
PDF
Dutch php conference_2010_opm
isnull
 
ODP
Caching and tuning fun for high scalability @ FOSDEM 2012
Wim Godden
 
PPTX
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Jonathan Klein
 
PPT
Zend Con 2008 Slides
mkherlakian
 
ODP
Caching and tuning fun for high scalability
Wim Godden
 
PPT
Top 30 Scalability Mistakes
John Coggeshall
 
ODP
Clug 2011 March web server optimisation
grooverdan
 
PDF
Clug 2012 March web server optimisation
grooverdan
 
Caching and tuning fun for high scalability
Wim Godden
 
Top ten-list
Brian DeShong
 
Top 10 Scalability Mistakes
John Coggeshall
 
Bottom to Top Stack Optimization with LAMP
katzgrau
 
Bottom to Top Stack Optimization - CICON2011
CodeIgniter Conference
 
Apache Con 2008 Top 10 Mistakes
John Coggeshall
 
Caching and tuning fun for high scalability @ PHPTour
Wim Godden
 
Scaling PHP apps
Matteo Moretti
 
EECI 2013 - ExpressionEngine Performance & Optimization - Laying a Solid Foun...
Nexcess.net LLC
 
Php go vrooom!
Elizabeth Smith
 
Scaling with Symfony - PHP UK
Ricard Clau
 
Dutch php conference_2010_opm
isnull
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Wim Godden
 
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Jonathan Klein
 
Zend Con 2008 Slides
mkherlakian
 
Caching and tuning fun for high scalability
Wim Godden
 
Top 30 Scalability Mistakes
John Coggeshall
 
Clug 2011 March web server optimisation
grooverdan
 
Clug 2012 March web server optimisation
grooverdan
 
Ad

Recently uploaded (20)

DOCX
How Digital Marketplaces are Empowering Emerging MedTech Brands
Ram Gopal Varma
 
PDF
Planning the parliament of the future in greece – considerations for a data-d...
Dr. Fotios Fitsilis
 
PDF
From Draft to DSN - How to Get your Paper In [DSN 2025 Doctoral Forum Keynote]
vschiavoni
 
PDF
The Impact of Game Live Streaming on In-Game Purchases of Chinese Young Game ...
Shibaura Institute of Technology
 
PPTX
Great-Books. Powerpoint presentation. files
tamayocrisgie
 
PPTX
INTRO-TO-EMPOWERMENT-TECHNOLGY grade 11 lesson
ReyAcosta8
 
PPTX
presentation on legal and regulatory action
raoharsh4122001
 
PDF
Jotform Presentation Agents: Use Cases and Examples
Jotform
 
PDF
Jotform Presentation Agents: Features and Benefits
Jotform
 
PPTX
Unit 1, 2 & 3 - Pharmacognosy - Defn_history_scope.pptx
bagewadivarsha2024
 
PPTX
STURGEON BAY WI AG PPT JULY 6 2025.pptx
FamilyWorshipCenterD
 
PDF
The Origin - A Simple Presentation on any project
RishabhDwivedi43
 
PDF
Buy Verified Coinbase Accounts — The Ultimate Guide for 2025 (Rank #1 on Goog...
Buy Verified Cash App Accounts
 
PPTX
Melbourne_Keynote_June_19_2013_without_photos.pptx
BryInfanteRayos
 
PDF
Buy Verified Payoneer Accounts — The Ultimate Guide for 2025 (Rank #1 on Goog...
Buy Verified Cash App Accounts
 
PDF
The Family Secret (essence of loveliness)
Favour Biodun
 
DOC
STABILITY INDICATING METHOD DEVELOPMENT AND VALIDATION FOR SIMULTANEOUS ESTIM...
jmkeans624
 
PPTX
Lesson 1-3(Learners' copy).pptxucspctopi
KrizeAnneCorneja
 
PDF
Model Project Report_36DR_G&P.pdf for investors understanding
MeetAgrawal23
 
PDF
Committee-Skills-Handbook---MUNprep.org.pdf
SatvikAgarwal9
 
How Digital Marketplaces are Empowering Emerging MedTech Brands
Ram Gopal Varma
 
Planning the parliament of the future in greece – considerations for a data-d...
Dr. Fotios Fitsilis
 
From Draft to DSN - How to Get your Paper In [DSN 2025 Doctoral Forum Keynote]
vschiavoni
 
The Impact of Game Live Streaming on In-Game Purchases of Chinese Young Game ...
Shibaura Institute of Technology
 
Great-Books. Powerpoint presentation. files
tamayocrisgie
 
INTRO-TO-EMPOWERMENT-TECHNOLGY grade 11 lesson
ReyAcosta8
 
presentation on legal and regulatory action
raoharsh4122001
 
Jotform Presentation Agents: Use Cases and Examples
Jotform
 
Jotform Presentation Agents: Features and Benefits
Jotform
 
Unit 1, 2 & 3 - Pharmacognosy - Defn_history_scope.pptx
bagewadivarsha2024
 
STURGEON BAY WI AG PPT JULY 6 2025.pptx
FamilyWorshipCenterD
 
The Origin - A Simple Presentation on any project
RishabhDwivedi43
 
Buy Verified Coinbase Accounts — The Ultimate Guide for 2025 (Rank #1 on Goog...
Buy Verified Cash App Accounts
 
Melbourne_Keynote_June_19_2013_without_photos.pptx
BryInfanteRayos
 
Buy Verified Payoneer Accounts — The Ultimate Guide for 2025 (Rank #1 on Goog...
Buy Verified Cash App Accounts
 
The Family Secret (essence of loveliness)
Favour Biodun
 
STABILITY INDICATING METHOD DEVELOPMENT AND VALIDATION FOR SIMULTANEOUS ESTIM...
jmkeans624
 
Lesson 1-3(Learners' copy).pptxucspctopi
KrizeAnneCorneja
 
Model Project Report_36DR_G&P.pdf for investors understanding
MeetAgrawal23
 
Committee-Skills-Handbook---MUNprep.org.pdf
SatvikAgarwal9
 
Ad

Silverstripe at scale - design & architecture for silverstripe applications