SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
EEUK2013
MySQL &
ExpressionEngine
Why EEvolution?
We believe that system efficiency is #1 as
its the root to saving time and costs
We provide cost effective solutions that
have a return on investment
We create software to solve problems
Sound Familiar?
- Why is my site is slow?
- How can I get better performance?
- What if I get an increase in visitors?
- Search bots are killing my server!
The database is the data store of your site
... but what can you do to get the best out of it?
DESIGN FOR PERFORMANCE & SCALE
Hardware: Platform
Cost Performance Reliability
Shared Low Low Medium
VPS Low Low / Variable Medium
Cloud Medium Medium Very High
Dynamic Cloud Medium / PAYG Medium Very High
Dedicated High Very High High
Private Cloud Very High High Very High
Hardware: CPU
Cores (40%)
- Single, Dual, Quad, Six, Hex
Clock Speed (30%)
- 2ghz, 3ghz, 4ghz
Vendor (20%)
- AMD vs Intel
CPUs (10%)
- Single vs Dual
Hardware: Memory
25% of Server Memory should cover Database
Indexes (not data in MyISAM)
- key_buffer_size = 25%-35% server memory
- PHPMyAdmin -> Status gives you a easy to
read analysis and config recommendation.
- Check RAM benchmarks when purchasing a
server
Hardware: Disk
IOPS & Random Reads
- SATA (75- 150)
- SAS (140 - 210)
- SSD (9,000 - 10,000,000)
- RAMDisk (30,000 - 50,000, use with caution!)
Hard disks need a good controller which is also
an important factor for performance.
Never mix disk types in a RAID
Operating System
Background Processes
Linux (LAMP, cPanel, Plesk, Webmin)
- CentOS
Windows (WAMP)
- Windows XP
- Windows 7
- Server 2008 + Core Mode
- Server 2012 + Core Mode
Indexes
SELECT = Read
INSERT, UPDATE, DELETE = Read/Write
- Writes will always force an index update.
- Only index columns that you will JOIN ON or
use in WHERE and ORDER BY.
- Schedule an auto DB optimisation.
- EE thottling has a big impact on DB writes
- Index files can be stored on a different disk.
Views, Stored Procedures,
Functions
- VIEWS are used for organisation not for
performance. They can improve speed due to
reduced lock times on large datasets.
- STORED PROCEDURES are used for
organisation not for performance. Don't give up
the dynamically created statement for the 'best
practice' it'll cost you in time.
- FUNCTIONS are used for organisation not for
performance. Stay away, you will only slow
down your queries and waste time.
Optimisation Maintenance
Automatically optimise your database with a
frequently run Cron or Scheduled Task
- Tuning Primer Script
- MySQL Tuning Script
Don't forget to email yourself the results.
Backup
Master / Slave, Replication
- Backup, Distribution
- Read only, Analysis (RAMDisk)
Clustering, RAID
- Resilience, Automatic Failover
Cron / Scheduled Task
- Custom Script, perhaps Amazon S3
WHM
- Scheduled Offsite Backup
So... we're firing on all cylinders!
Remember:
- Get best value hardware for your budget
- Configure for the correct situation
- Use PHPMyAdmin Status & Tuning Script
- Ensure Backup / Replication / Resilience
... Just in case, but always a must!
NOW LETS LOOK AT EE...
EE Settings
- Disable what you don't need
- Page, Template, DB, Tag Cache
- Config: Disable Tracking
Query Cache
EE Dynamic Query Cache:
- If you do not use future entries, expiring
entries and random entries turn this on.
- MySQL also has a cache mechanism which
can improve performance by +200% when
retrieving data from tables that do not change
often. In general it has a 13% overhead. Set
query_cache_size between 10MB and 150MB
(avg size of query results * number of queries)
Schema
EE Schema
- Entry data is wide not deep for scalability.
- Relationships are centralised for simplicity.
- Follow true relationships on your addons for
best performance.
- Index columns based on EE SQL Debug
results. e.g. Searchable custom fields. Don't
assume the schema is 100% efficient out of the
box for EE or third party addons.
Pre-calculated fields
Do on-the-fly calculations in a dedicated field
based on triggered events
- Total number of sales
- Total revenue per member
- Total entry count per member or category
- Run a sanity check/update when idle to
ensure this is accurate regularly.
- Gives you the flexibility to COUNT (accurate,
latency) or SELECT (possibly inaccurate, v.
fast)
EE Entry DB Structure
Get Entries From Table - {exp:query sql=""}
SELECT *, t.*, t.entry_id, COUNT(DISTINCT p.cat_name) AS distinct_count, CASE WHEN IFNULL
(NULLIF(field_id_15,''),'none')='none' THEN field_id_16 ELSE field_id_15 END AS choice
FROM exp_channel_titles t
INNER JOIN exp_channel_data d ON d.entry_id = t.entry_id
INNER JOIN exp_members m ON m.member_id = t.author_id
INNER JOIN exp_member_groups mg ON mg.group_id = m.group_id
INNER JOIN exp_member_data md ON md.member_id = m.member_id
LEFT OUTER JOIN exp_category_posts p ON p.entry_id = t.entry_id
LEFT OUTER JOIN exp_categories c ON c.cat_id = p.cat_id
LEFT OUTER JOIN exp_category_field_data cfd ON cfd.cat_id = c.cat_id
WHERE t.status='open' OR t.entry_id = (0{entry_id}) OR t.entry_id IN (0{preload_replace_vars}) OR t.
entry_id IN (0{snippet_var}) OR p.cat_url_title = '{segment_3}' OR d.field_id_16 LIKE 'test%' OR t.
entry_date > UNIX_TIMESTAMP('2013-05-16 00:00:00') OR d.field_id_16 = d.field_id_17 OR t.
entry_id IN ({snippet_subquery_chosen_categories})
ORDER BY t.entry_date DESC
GROUP BY t.entry_id HAVING COUNT(p.cat_name) > 2
Summary
Remember:
- Use this document as a reference
- Plan your system resources, configure
appropriately and use EE Debug Tools
- Don't be afraid to use {exp:query} to get what
you need.
- Contact us if you need assistance in hardware
or database decisions, optimisation or advice
on your system... we're here to help.
Thank You !
Any Questions?
Tim Mahoney
EEvolution Limited
info@eevolution.co.uk

Contenu connexe

Tendances

Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
Mao Geng
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
Enkitec
 
MySQL Administration and Monitoring
MySQL Administration and MonitoringMySQL Administration and Monitoring
MySQL Administration and Monitoring
Mark Leith
 
Tips and Tricks for SAP Sybase IQ
Tips and Tricks for SAP  Sybase IQTips and Tricks for SAP  Sybase IQ
Tips and Tricks for SAP Sybase IQ
Don Brizendine
 

Tendances (20)

Oracle’ın parallel execution yetenekleri ve performans
Oracle’ın parallel execution yetenekleri ve performansOracle’ın parallel execution yetenekleri ve performans
Oracle’ın parallel execution yetenekleri ve performans
 
01 oracle architecture
01 oracle architecture01 oracle architecture
01 oracle architecture
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
 
SQL Server Optimization Checklist
SQL Server Optimization ChecklistSQL Server Optimization Checklist
SQL Server Optimization Checklist
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
 
PostgreSQL Hangout Parameter Tuning
PostgreSQL Hangout Parameter TuningPostgreSQL Hangout Parameter Tuning
PostgreSQL Hangout Parameter Tuning
 
MySQL Administration and Monitoring
MySQL Administration and MonitoringMySQL Administration and Monitoring
MySQL Administration and Monitoring
 
An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1
 
Getting to Know MySQL Enterprise Monitor
Getting to Know MySQL Enterprise MonitorGetting to Know MySQL Enterprise Monitor
Getting to Know MySQL Enterprise Monitor
 
Improving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLImproving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQL
 
Veri Ambarları için Oracle'ın Analitik SQL Desteği
Veri Ambarları için Oracle'ın Analitik SQL DesteğiVeri Ambarları için Oracle'ın Analitik SQL Desteği
Veri Ambarları için Oracle'ın Analitik SQL Desteği
 
resource governor
resource governorresource governor
resource governor
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
Oracle PL/SQL Best Practices
Oracle PL/SQL Best PracticesOracle PL/SQL Best Practices
Oracle PL/SQL Best Practices
 
PostgreSQL Hangout Replication Features v9.4
PostgreSQL Hangout Replication Features v9.4PostgreSQL Hangout Replication Features v9.4
PostgreSQL Hangout Replication Features v9.4
 
Weblogic plug in
Weblogic plug inWeblogic plug in
Weblogic plug in
 
Tips and Tricks for SAP Sybase IQ
Tips and Tricks for SAP  Sybase IQTips and Tricks for SAP  Sybase IQ
Tips and Tricks for SAP Sybase IQ
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 

En vedette

02 dao dinh kha - idg 2009 (dinh kha) (v2) - last
02   dao dinh kha -  idg 2009 (dinh kha) (v2) - last02   dao dinh kha -  idg 2009 (dinh kha) (v2) - last
02 dao dinh kha - idg 2009 (dinh kha) (v2) - last
Daihocngoaingu English
 
кутузова е.к. фгу_3_курс_два_колеса
кутузова е.к. фгу_3_курс_два_колесакутузова е.к. фгу_3_курс_два_колеса
кутузова е.к. фгу_3_курс_два_колеса
Evgeniya Kutuzova
 
Reading strategies
Reading strategies Reading strategies
Reading strategies
Riez Thiena
 

En vedette (16)

Познатите... непознатите
Познатите... непознатитеПознатите... непознатите
Познатите... непознатите
 
30 години Национален младежки конкурс за поезия "Веселин Ханчев" - Стара Загора
30 години Национален младежки конкурс за поезия "Веселин Ханчев" - Стара Загора30 години Национален младежки конкурс за поезия "Веселин Ханчев" - Стара Загора
30 години Национален младежки конкурс за поезия "Веселин Ханчев" - Стара Загора
 
02 dao dinh kha - idg 2009 (dinh kha) (v2) - last
02   dao dinh kha -  idg 2009 (dinh kha) (v2) - last02   dao dinh kha -  idg 2009 (dinh kha) (v2) - last
02 dao dinh kha - idg 2009 (dinh kha) (v2) - last
 
Библиотека Родина 2013
Библиотека Родина 2013Библиотека Родина 2013
Библиотека Родина 2013
 
Teens24
Teens24Teens24
Teens24
 
Краткосмешен Казанлък
Краткосмешен КазанлъкКраткосмешен Казанлък
Краткосмешен Казанлък
 
Ankit singh rana plc
Ankit singh rana plc Ankit singh rana plc
Ankit singh rana plc
 
кутузова е.к. фгу_3_курс_два_колеса
кутузова е.к. фгу_3_курс_два_колесакутузова е.к. фгу_3_курс_два_колеса
кутузова е.к. фгу_3_курс_два_колеса
 
Опитът на библиотека Родина в дигитализацията на библиотечни колекции и предс...
Опитът на библиотека Родина в дигитализацията на библиотечни колекции и предс...Опитът на библиотека Родина в дигитализацията на библиотечни колекции и предс...
Опитът на библиотека Родина в дигитализацията на библиотечни колекции и предс...
 
Reading strategies
Reading strategies Reading strategies
Reading strategies
 
Развитие на Обществен информационен център – опитът на библиотека "Родина"
Развитие на Обществен информационен център – опитът на библиотека "Родина"Развитие на Обществен информационен център – опитът на библиотека "Родина"
Развитие на Обществен информационен център – опитът на библиотека "Родина"
 
Presentation trade vietnamese
Presentation trade vietnamesePresentation trade vietnamese
Presentation trade vietnamese
 
Националният литературен конкурс „Моята родина и моето бъдеще” - Стара Загора...
Националният литературен конкурс „Моята родина и моето бъдеще” - Стара Загора...Националният литературен конкурс „Моята родина и моето бъдеще” - Стара Загора...
Националният литературен конкурс „Моята родина и моето бъдеще” - Стара Загора...
 
Top 5 benefits elken spirulina
Top 5 benefits elken spirulinaTop 5 benefits elken spirulina
Top 5 benefits elken spirulina
 
NIOS std X Economics Ch 9 Demand
NIOS std X Economics Ch 9 DemandNIOS std X Economics Ch 9 Demand
NIOS std X Economics Ch 9 Demand
 
NIOS X Economics Ch 11, Ch 12 and Ch 13 Determination of Price, Market and ro...
NIOS X Economics Ch 11, Ch 12 and Ch 13 Determination of Price, Market and ro...NIOS X Economics Ch 11, Ch 12 and Ch 13 Determination of Price, Market and ro...
NIOS X Economics Ch 11, Ch 12 and Ch 13 Determination of Price, Market and ro...
 

Similaire à MySQL & Expression Engine EEUK2013

MySQL Scaling Presentation
MySQL Scaling PresentationMySQL Scaling Presentation
MySQL Scaling Presentation
Tommy Falgout
 
Ssis Best Practices Israel Bi U Ser Group Itay Braun
Ssis Best Practices   Israel Bi U Ser Group   Itay BraunSsis Best Practices   Israel Bi U Ser Group   Itay Braun
Ssis Best Practices Israel Bi U Ser Group Itay Braun
sqlserver.co.il
 
Explore big data at speed of thought with Spark 2.0 and Snappydata
Explore big data at speed of thought with Spark 2.0 and SnappydataExplore big data at speed of thought with Spark 2.0 and Snappydata
Explore big data at speed of thought with Spark 2.0 and Snappydata
Data Con LA
 
Troubleshooting SQL Server
Troubleshooting SQL ServerTroubleshooting SQL Server
Troubleshooting SQL Server
Stephen Rose
 

Similaire à MySQL & Expression Engine EEUK2013 (20)

MySQL Scaling Presentation
MySQL Scaling PresentationMySQL Scaling Presentation
MySQL Scaling Presentation
 
Ssis Best Practices Israel Bi U Ser Group Itay Braun
Ssis Best Practices   Israel Bi U Ser Group   Itay BraunSsis Best Practices   Israel Bi U Ser Group   Itay Braun
Ssis Best Practices Israel Bi U Ser Group Itay Braun
 
Dynamics ax performance tuning
Dynamics ax performance tuningDynamics ax performance tuning
Dynamics ax performance tuning
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTour
 
11g R2
11g R211g R2
11g R2
 
Explore big data at speed of thought with Spark 2.0 and Snappydata
Explore big data at speed of thought with Spark 2.0 and SnappydataExplore big data at speed of thought with Spark 2.0 and Snappydata
Explore big data at speed of thought with Spark 2.0 and Snappydata
 
SQL Server - High availability
SQL Server - High availabilitySQL Server - High availability
SQL Server - High availability
 
Best Practices for Building Robust Data Platform with Apache Spark and Delta
Best Practices for Building Robust Data Platform with Apache Spark and DeltaBest Practices for Building Robust Data Platform with Apache Spark and Delta
Best Practices for Building Robust Data Platform with Apache Spark and Delta
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 
SQL Server 2014 for Developers (Cristian Lefter)
SQL Server 2014 for Developers (Cristian Lefter)SQL Server 2014 for Developers (Cristian Lefter)
SQL Server 2014 for Developers (Cristian Lefter)
 
Loading Data into Redshift
Loading Data into RedshiftLoading Data into Redshift
Loading Data into Redshift
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
 
DP-900.pdf
DP-900.pdfDP-900.pdf
DP-900.pdf
 
Loading Data into Redshift
Loading Data into RedshiftLoading Data into Redshift
Loading Data into Redshift
 
Understanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQLUnderstanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQL
 
Loading Data into Redshift: Data Analytics Week at the SF Loft
Loading Data into Redshift: Data Analytics Week at the SF LoftLoading Data into Redshift: Data Analytics Week at the SF Loft
Loading Data into Redshift: Data Analytics Week at the SF Loft
 
Troubleshooting SQL Server
Troubleshooting SQL ServerTroubleshooting SQL Server
Troubleshooting SQL Server
 
IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

MySQL & Expression Engine EEUK2013

  • 2. Why EEvolution? We believe that system efficiency is #1 as its the root to saving time and costs We provide cost effective solutions that have a return on investment We create software to solve problems
  • 3. Sound Familiar? - Why is my site is slow? - How can I get better performance? - What if I get an increase in visitors? - Search bots are killing my server! The database is the data store of your site ... but what can you do to get the best out of it? DESIGN FOR PERFORMANCE & SCALE
  • 4. Hardware: Platform Cost Performance Reliability Shared Low Low Medium VPS Low Low / Variable Medium Cloud Medium Medium Very High Dynamic Cloud Medium / PAYG Medium Very High Dedicated High Very High High Private Cloud Very High High Very High
  • 5. Hardware: CPU Cores (40%) - Single, Dual, Quad, Six, Hex Clock Speed (30%) - 2ghz, 3ghz, 4ghz Vendor (20%) - AMD vs Intel CPUs (10%) - Single vs Dual
  • 6. Hardware: Memory 25% of Server Memory should cover Database Indexes (not data in MyISAM) - key_buffer_size = 25%-35% server memory - PHPMyAdmin -> Status gives you a easy to read analysis and config recommendation. - Check RAM benchmarks when purchasing a server
  • 7. Hardware: Disk IOPS & Random Reads - SATA (75- 150) - SAS (140 - 210) - SSD (9,000 - 10,000,000) - RAMDisk (30,000 - 50,000, use with caution!) Hard disks need a good controller which is also an important factor for performance. Never mix disk types in a RAID
  • 8. Operating System Background Processes Linux (LAMP, cPanel, Plesk, Webmin) - CentOS Windows (WAMP) - Windows XP - Windows 7 - Server 2008 + Core Mode - Server 2012 + Core Mode
  • 9. Indexes SELECT = Read INSERT, UPDATE, DELETE = Read/Write - Writes will always force an index update. - Only index columns that you will JOIN ON or use in WHERE and ORDER BY. - Schedule an auto DB optimisation. - EE thottling has a big impact on DB writes - Index files can be stored on a different disk.
  • 10. Views, Stored Procedures, Functions - VIEWS are used for organisation not for performance. They can improve speed due to reduced lock times on large datasets. - STORED PROCEDURES are used for organisation not for performance. Don't give up the dynamically created statement for the 'best practice' it'll cost you in time. - FUNCTIONS are used for organisation not for performance. Stay away, you will only slow down your queries and waste time.
  • 11. Optimisation Maintenance Automatically optimise your database with a frequently run Cron or Scheduled Task - Tuning Primer Script - MySQL Tuning Script Don't forget to email yourself the results.
  • 12. Backup Master / Slave, Replication - Backup, Distribution - Read only, Analysis (RAMDisk) Clustering, RAID - Resilience, Automatic Failover Cron / Scheduled Task - Custom Script, perhaps Amazon S3 WHM - Scheduled Offsite Backup
  • 13. So... we're firing on all cylinders! Remember: - Get best value hardware for your budget - Configure for the correct situation - Use PHPMyAdmin Status & Tuning Script - Ensure Backup / Replication / Resilience ... Just in case, but always a must! NOW LETS LOOK AT EE...
  • 14. EE Settings - Disable what you don't need - Page, Template, DB, Tag Cache - Config: Disable Tracking
  • 15. Query Cache EE Dynamic Query Cache: - If you do not use future entries, expiring entries and random entries turn this on. - MySQL also has a cache mechanism which can improve performance by +200% when retrieving data from tables that do not change often. In general it has a 13% overhead. Set query_cache_size between 10MB and 150MB (avg size of query results * number of queries)
  • 16. Schema EE Schema - Entry data is wide not deep for scalability. - Relationships are centralised for simplicity. - Follow true relationships on your addons for best performance. - Index columns based on EE SQL Debug results. e.g. Searchable custom fields. Don't assume the schema is 100% efficient out of the box for EE or third party addons.
  • 17. Pre-calculated fields Do on-the-fly calculations in a dedicated field based on triggered events - Total number of sales - Total revenue per member - Total entry count per member or category - Run a sanity check/update when idle to ensure this is accurate regularly. - Gives you the flexibility to COUNT (accurate, latency) or SELECT (possibly inaccurate, v. fast)
  • 18. EE Entry DB Structure Get Entries From Table - {exp:query sql=""} SELECT *, t.*, t.entry_id, COUNT(DISTINCT p.cat_name) AS distinct_count, CASE WHEN IFNULL (NULLIF(field_id_15,''),'none')='none' THEN field_id_16 ELSE field_id_15 END AS choice FROM exp_channel_titles t INNER JOIN exp_channel_data d ON d.entry_id = t.entry_id INNER JOIN exp_members m ON m.member_id = t.author_id INNER JOIN exp_member_groups mg ON mg.group_id = m.group_id INNER JOIN exp_member_data md ON md.member_id = m.member_id LEFT OUTER JOIN exp_category_posts p ON p.entry_id = t.entry_id LEFT OUTER JOIN exp_categories c ON c.cat_id = p.cat_id LEFT OUTER JOIN exp_category_field_data cfd ON cfd.cat_id = c.cat_id WHERE t.status='open' OR t.entry_id = (0{entry_id}) OR t.entry_id IN (0{preload_replace_vars}) OR t. entry_id IN (0{snippet_var}) OR p.cat_url_title = '{segment_3}' OR d.field_id_16 LIKE 'test%' OR t. entry_date > UNIX_TIMESTAMP('2013-05-16 00:00:00') OR d.field_id_16 = d.field_id_17 OR t. entry_id IN ({snippet_subquery_chosen_categories}) ORDER BY t.entry_date DESC GROUP BY t.entry_id HAVING COUNT(p.cat_name) > 2
  • 19. Summary Remember: - Use this document as a reference - Plan your system resources, configure appropriately and use EE Debug Tools - Don't be afraid to use {exp:query} to get what you need. - Contact us if you need assistance in hardware or database decisions, optimisation or advice on your system... we're here to help.
  • 20. Thank You ! Any Questions? Tim Mahoney EEvolution Limited info@eevolution.co.uk