SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
LAMPTo speed things up a bit
Going Beyond...
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Going beyond shared hosts
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
WHERE TO PLAY?
CheapVPS/DedicatedBox
Vagrant
Usethirdpartyservices
PAAShosting
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
LAMP
Linux
Apache
MySQL
PHP
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
L[AMP]
Linux
Apache
MySQL
PHP
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
WIMP
Windows
IIS
MySQL
PHP
REALLY!!!
OMG You like Serious init!
CRAZY??
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
[AMP]
“Use the best tool for the job...
...Not just the most popular”
- almost certainly an engineer
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
[AMP]
“You don’t dig latrines with a swiss army knife”
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
ANGINX HTTP and Proxy
Server
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
AApache is like Microsoft Word, it has a million options but you only need six. Nginx
does those six things, and it does five of them 50 times faster than Apache.
- Chris Lea (https://chrislea.com/)
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
MMaria DB & Percona
Server
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
PHipHop Virtual Machine
(HHVM)
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
P
<?hh
function yieldInfiniteInts(): Continuation<int> {
  $i = 0;
  while (true) {
    yield $i++;
  }
}
!
$generator = yieldInfiniteInts();
foreach ($generator as $value) {
  echo "$valuen";
}
http://docs.hhvm.com/manual/en/hack.continuations.php
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
P
async function getAsyncTemplatePart( $slug, $name = false ) {
return get_template_part( $slug, $name );
}
!
async function gatherTemplateParts($templates) {
$return = array();
!
foreach( $templates as $slug => $name ) {
$return[] = getAsyncTemplatePart( $slug, $name );
}
!
await GenArrayWaitHandle::create($return);
}
!
gatherTemplateParts( $templates )->join();
Async grabbing WordPress Templates in HackLang
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Key value stores
Memcached and Redis (Redis Cloud)
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
id user_login user_pass user_nicename user_email …
1 tim diufhdiufg£bsdh874£423223 Tim tim@avvisi.co.uk …
Traditional SQL DB
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Key : Value : Expiry (Optional)
!
Tim : Geeky
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
WHAT ARE THEY GOOD FOR IN WORDPRESS?
StoringreplicableData…
Transients
Caching
JobQueuesbackends
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Memory comes and goes
especially with age!
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Transients API
Key : Value : Expiry (Optional)
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Using KSV to cache
WordPress
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Rendering/ Template/Theme
Processing/ Objects
MySQL
HTTP/ Other Services
WordPress
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Page/Fragment Caching
Object Caching
Query Cache
HTTP Caching
Caching
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Caching can and will
screw with you!
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Queue Management
Beanstalkd & Gearman
(Amazon SQS)
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk
1. WordPress sends job to queue
2. Job Server (Beanstalk, Gearman) Holds in a
queue
3. Worker picks job from the queue and
completes it
2.
3.
1.
QUEUE MANAGEMENT SYSTEM
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk
1. User clicks approve on a comment,
WordPress queries the database and collects
all the emails to notify and the message to
send and passes it to the job server. 

2. Job Server put’s the emails into a queue

3. Script calls the queue server and takes the
email and message, emails the user and
marks job complete, repeats until the queue
is empty2.
3.
1.
QUEUE MANAGEMENT SYSTEM (IN PRACTICE)
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
function gatherTemplateParts( $templates ){
$client = new GearmanClient();
$client->addServer();
$client->setCompleteCallback(function(GearmanTask $task,
$context) use (&$return) {
$return[] = $task->data();
});
!
foreach( $templates as $template ){
$client->addTask('getAsyncTemplatePart', $template );
}
client->runTasks();
}
ASYNC WITH GEARMAN - CLIENT
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
$worker = new GearmanWorker();
$worker->addServer();
$worker->addFunction('getAsyncTemplatePart',
function(GearmanJob $job){
return get_template_part( key(), current() );
});
while ($worker->work());
ASYNC WITH GEARMAN - WORKER
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Caching reverse proxies
Varnish
(CloudFront, CloudFlare)
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
CLOUDFRONT
NGINX
(ORIGIN)
NGINX
Server
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
VARNISH
NGINX
(ORIGIN)
PROXY CACHING OVER SSL WITH VARNISH
NGINX
SSL END
POINT
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
Caching can and will
screw with you!
COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012
TimNash.co.uk @tnash #beyondLAMP
TheEnd!
Thanks for listening and don’t forget to visit...
!
!
Slides: https://timnash.co.uk/mwug-may-2014

Contenu connexe

Tendances

The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of DjangoJacob Kaplan-Moss
 
Say YES to Premature Optimizations
Say YES to Premature OptimizationsSay YES to Premature Optimizations
Say YES to Premature OptimizationsMaude Lemaire
 
Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Workhorse Computing
 
Creating and Maintaining WordPress Plugins
Creating and Maintaining WordPress PluginsCreating and Maintaining WordPress Plugins
Creating and Maintaining WordPress PluginsMark Jaquith
 
Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Adam Tomat
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Ansible : what's ansible & use case by REX
Ansible :  what's ansible & use case by REXAnsible :  what's ansible & use case by REX
Ansible : what's ansible & use case by REXSaewoong Lee
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websitesoazabir
 
Entry-level PHP for WordPress
Entry-level PHP for WordPressEntry-level PHP for WordPress
Entry-level PHP for WordPresssprclldr
 
PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽Anna Su
 
DNS for Developers - NDC Oslo 2016
DNS for Developers - NDC Oslo 2016DNS for Developers - NDC Oslo 2016
DNS for Developers - NDC Oslo 2016Maarten Balliauw
 
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Maarten Balliauw
 

Tendances (20)

Ruby For Startups
Ruby For StartupsRuby For Startups
Ruby For Startups
 
Selenium sandwich-2
Selenium sandwich-2Selenium sandwich-2
Selenium sandwich-2
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
 
Say YES to Premature Optimizations
Say YES to Premature OptimizationsSay YES to Premature Optimizations
Say YES to Premature Optimizations
 
Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium Selenium Sandwich Part 1: Data driven Selenium
Selenium Sandwich Part 1: Data driven Selenium
 
Cake php
Cake phpCake php
Cake php
 
Creating and Maintaining WordPress Plugins
Creating and Maintaining WordPress PluginsCreating and Maintaining WordPress Plugins
Creating and Maintaining WordPress Plugins
 
Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Ansible : what's ansible & use case by REX
Ansible :  what's ansible & use case by REXAnsible :  what's ansible & use case by REX
Ansible : what's ansible & use case by REX
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
 
Tomcat ssl 設定
Tomcat ssl 設定Tomcat ssl 設定
Tomcat ssl 設定
 
Lampstack (1)
Lampstack (1)Lampstack (1)
Lampstack (1)
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
 
Get queued
Get queuedGet queued
Get queued
 
Entry-level PHP for WordPress
Entry-level PHP for WordPressEntry-level PHP for WordPress
Entry-level PHP for WordPress
 
PHP and Mysql
PHP and MysqlPHP and Mysql
PHP and Mysql
 
PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽PWA 應用 - 實現網站離線瀏覽
PWA 應用 - 實現網站離線瀏覽
 
DNS for Developers - NDC Oslo 2016
DNS for Developers - NDC Oslo 2016DNS for Developers - NDC Oslo 2016
DNS for Developers - NDC Oslo 2016
 
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...
 

Similaire à Going Beyond LAMP Again - Manchester WordPress User Group

Going beyond unit tests - WordCamp London 2015
Going beyond unit tests -  WordCamp London 2015Going beyond unit tests -  WordCamp London 2015
Going beyond unit tests - WordCamp London 2015Tim Nash
 
Why is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenariosWhy is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenariosDivante
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanIssac Goldstand
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)Wesley Beary
 
OpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con PythonOpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con PythonPyCon Italia
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress DevelopmentAdam Tomat
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kianphelios
 
OOP Is More Than Cars and Dogs
OOP Is More Than Cars and DogsOOP Is More Than Cars and Dogs
OOP Is More Than Cars and DogsChris Tankersley
 
Gearman - Job Queue
Gearman - Job QueueGearman - Job Queue
Gearman - Job QueueDiego Lewin
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
Codemotion Rome 2018 Docker Swarm Mode
Codemotion Rome 2018 Docker Swarm ModeCodemotion Rome 2018 Docker Swarm Mode
Codemotion Rome 2018 Docker Swarm ModeSimone Soldateschi
 
CIS407AWk2iLabDefault.aspx Greetings and Salutations.docx
CIS407AWk2iLabDefault.aspx        Greetings and Salutations.docxCIS407AWk2iLabDefault.aspx        Greetings and Salutations.docx
CIS407AWk2iLabDefault.aspx Greetings and Salutations.docxclarebernice
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web frameworktaggg
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and SymfonyIgnacio Martín
 
Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01longtuan
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
 

Similaire à Going Beyond LAMP Again - Manchester WordPress User Group (20)

Going beyond unit tests - WordCamp London 2015
Going beyond unit tests -  WordCamp London 2015Going beyond unit tests -  WordCamp London 2015
Going beyond unit tests - WordCamp London 2015
 
Why is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenariosWhy is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenarios
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & Gearman
 
PHPSpec BDD Framework
PHPSpec BDD FrameworkPHPSpec BDD Framework
PHPSpec BDD Framework
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
OpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con PythonOpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con Python
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kian
 
OOP Is More Than Cars and Dogs
OOP Is More Than Cars and DogsOOP Is More Than Cars and Dogs
OOP Is More Than Cars and Dogs
 
Gearman - Job Queue
Gearman - Job QueueGearman - Job Queue
Gearman - Job Queue
 
PHP - Intriduction to MySQL And PHP
PHP - Intriduction to MySQL And PHPPHP - Intriduction to MySQL And PHP
PHP - Intriduction to MySQL And PHP
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Codemotion Rome 2018 Docker Swarm Mode
Codemotion Rome 2018 Docker Swarm ModeCodemotion Rome 2018 Docker Swarm Mode
Codemotion Rome 2018 Docker Swarm Mode
 
CIS407AWk2iLabDefault.aspx Greetings and Salutations.docx
CIS407AWk2iLabDefault.aspx        Greetings and Salutations.docxCIS407AWk2iLabDefault.aspx        Greetings and Salutations.docx
CIS407AWk2iLabDefault.aspx Greetings and Salutations.docx
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
 
Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
Msql
Msql Msql
Msql
 

Going Beyond LAMP Again - Manchester WordPress User Group

  • 1. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP LAMPTo speed things up a bit Going Beyond...
  • 2. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Going beyond shared hosts
  • 3. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP WHERE TO PLAY? CheapVPS/DedicatedBox Vagrant Usethirdpartyservices PAAShosting
  • 4. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP LAMP Linux Apache MySQL PHP
  • 5. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP L[AMP] Linux Apache MySQL PHP
  • 6. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP WIMP Windows IIS MySQL PHP REALLY!!! OMG You like Serious init! CRAZY??
  • 7. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP [AMP] “Use the best tool for the job... ...Not just the most popular” - almost certainly an engineer
  • 8. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP [AMP] “You don’t dig latrines with a swiss army knife”
  • 9. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP ANGINX HTTP and Proxy Server
  • 10. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP AApache is like Microsoft Word, it has a million options but you only need six. Nginx does those six things, and it does five of them 50 times faster than Apache. - Chris Lea (https://chrislea.com/)
  • 11. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP MMaria DB & Percona Server
  • 12. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP PHipHop Virtual Machine (HHVM)
  • 13. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP P <?hh function yieldInfiniteInts(): Continuation<int> {   $i = 0;   while (true) {     yield $i++;   } } ! $generator = yieldInfiniteInts(); foreach ($generator as $value) {   echo "$valuen"; } http://docs.hhvm.com/manual/en/hack.continuations.php
  • 14. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP P async function getAsyncTemplatePart( $slug, $name = false ) { return get_template_part( $slug, $name ); } ! async function gatherTemplateParts($templates) { $return = array(); ! foreach( $templates as $slug => $name ) { $return[] = getAsyncTemplatePart( $slug, $name ); } ! await GenArrayWaitHandle::create($return); } ! gatherTemplateParts( $templates )->join(); Async grabbing WordPress Templates in HackLang
  • 15. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Key value stores Memcached and Redis (Redis Cloud)
  • 16. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP id user_login user_pass user_nicename user_email … 1 tim diufhdiufg£bsdh874£423223 Tim tim@avvisi.co.uk … Traditional SQL DB
  • 17. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Key : Value : Expiry (Optional) ! Tim : Geeky
  • 18. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP WHAT ARE THEY GOOD FOR IN WORDPRESS? StoringreplicableData… Transients Caching JobQueuesbackends
  • 19. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Memory comes and goes especially with age!
  • 20. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Transients API Key : Value : Expiry (Optional)
  • 21. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Using KSV to cache WordPress
  • 22. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Rendering/ Template/Theme Processing/ Objects MySQL HTTP/ Other Services WordPress
  • 23. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Page/Fragment Caching Object Caching Query Cache HTTP Caching Caching
  • 24. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Caching can and will screw with you!
  • 25. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Queue Management Beanstalkd & Gearman (Amazon SQS)
  • 26. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk 1. WordPress sends job to queue 2. Job Server (Beanstalk, Gearman) Holds in a queue 3. Worker picks job from the queue and completes it 2. 3. 1. QUEUE MANAGEMENT SYSTEM
  • 27. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk 1. User clicks approve on a comment, WordPress queries the database and collects all the emails to notify and the message to send and passes it to the job server. 
 2. Job Server put’s the emails into a queue
 3. Script calls the queue server and takes the email and message, emails the user and marks job complete, repeats until the queue is empty2. 3. 1. QUEUE MANAGEMENT SYSTEM (IN PRACTICE)
  • 28. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP function gatherTemplateParts( $templates ){ $client = new GearmanClient(); $client->addServer(); $client->setCompleteCallback(function(GearmanTask $task, $context) use (&$return) { $return[] = $task->data(); }); ! foreach( $templates as $template ){ $client->addTask('getAsyncTemplatePart', $template ); } client->runTasks(); } ASYNC WITH GEARMAN - CLIENT
  • 29. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP $worker = new GearmanWorker(); $worker->addServer(); $worker->addFunction('getAsyncTemplatePart', function(GearmanJob $job){ return get_template_part( key(), current() ); }); while ($worker->work()); ASYNC WITH GEARMAN - WORKER
  • 30. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Caching reverse proxies Varnish (CloudFront, CloudFlare)
  • 31. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP CLOUDFRONT NGINX (ORIGIN) NGINX Server
  • 32. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP VARNISH NGINX (ORIGIN) PROXY CACHING OVER SSL WITH VARNISH NGINX SSL END POINT
  • 33. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP Caching can and will screw with you!
  • 34. COMPANY NAME PRESENTATION TITLE 12 - 12 - 2012 TimNash.co.uk @tnash #beyondLAMP TheEnd! Thanks for listening and don’t forget to visit... ! ! Slides: https://timnash.co.uk/mwug-may-2014