SlideShare une entreprise Scribd logo
1  sur  31
Do you queue? Characteristics of scalability Kevin Schroeder Technology Evangelist Zend Technologies
About me  Past: Programming/Sys Admin  Current: Technology Evangelist/Author/Composer          @kpschrade
I blog at eschrade.com Follow us! (good things will happen to you) Zend Technologies http://twitter.com/zend http://twitter.com/kpschrade (me!)
Twtpoll results Could your PHP apps benefit from being able to process data or execute asynchronously?
Why would you want to queue? Performance Execute logic apart from the main request (asynchronicity) Scalability The ability to handle non-immediate logic as resources are available
Typical anatomy of a PHP Application Bad for scala-bility! Presentation Application Control Database Access Business Logic Presentation Application Control Business Logic Presentation | 6
Good for Scalability Presentation Something.phtml Something.phtml Something.phtml Something.phtml Something.phtml Something.phtml Something.phtml Something.phtml Application Control Something.php Something.php Something.php Something.php Something.php Something.php Something.php Something.php Business Logic Something.php Something.php Something.php Something.php Something.php Something.php Something.php Something.php Database Access Something.php Something.php Something.php Something.php Something.php Something.php Something.php Something.php | 7  |   8-Feb-11
What helps make software scalable? Defined tasks Loose coupling Resource discovery
The Golden Rule of Scalability “It can probably wait”
Asynchronous execution uses Pre-caching data Data analysis Data processing Pre-calculating (preparing data for the next request) Data is “out of date” once it leaves the web server Immediacy is seldom necessary
Characteristics A sledgehammer can hit a machine Scalability and High Availability are yin and yang A site that can’t keep running is not scalable A site that can’t scale will fail (if it gets really popular) Machines can be added and removed at will Not “cloudy” necessarily No single point of failure Data exists in at least two, preferably at least three, places
Considerations Waste disk space Control usage (don’t let users do anything they want) Pre-calculate as much as possible Calculate and cache/store Keep data processing off the front end servers Don’t just cache Don’t let it substitute for thought Cache hit rates can be meaningless if you have hundreds of cache hits for a request
Considerations ,[object Object]
Make as much as possible configurable/discoverableDecouple/Partition Don’t tie everything (relationships and such) into the database Use queues/messaging Stomp interfaces are really good for PHP – Can also use Java Bridge Zend_Queue has several interfaces Try to use stateless interfaces (polling is more scalable than idle connections)
Options Use Cron /w PHP CLI (not the best idea) People mostly use cron simply due to availability It’s an available option, not necessarily the best option. Use Gearman Use home-grown (don’t do this) Use pcntl_fork() (NEVER do this) Use Zend Server Job Queue
Your only real options Very cloud friendly * I am not an expert on Gearman.  Corrections will be taken in the spirit that they are given. For obvious reasons, I will focus on Zend Server
Zend Framework Zend Server PHP Application Performance Reliability & Management Scale-Out Business-grade PHP Acceleration Monitoring Clustering Hot Fixes Optimization Root-Cause Job Queue Support Caching Downloads Java Bridge Configuration Linux (rpm/web repositories) IBM i (PTF) Windows (MSI)  What the heck is Zend Server? 16 Zend Server
Job Queue Architecture – Elastic Backend Web Server /w JQ Web Server Users! Web Server /w JQ Web Server Load Balancer Web Server /w JQ Web Server Pros Scale the backend as necessary Default (easy) mechanism Cons Getting the job status requires using a DB
Job Queue Architecture – Elastic Frontend Web Server Web Server /w JQ Users! Web Server Web Server /w JQ Load Balancer Web Server Web Server /w JQ Pros Easy to communicate with the Job Queue server handling the job Cons Requires you to build your own interface (or just use mine!)
Kevin’s favorite way to implement it Create a task-handling controller Create an abstract task class Understands the Job Queue Self contained If Elastic Backend: connects to localhost If Elastic Frontend: connects to load balancer (my preferred), load balanced JQ servers manage themselves Execute the task, have it serialize itself and send it to send to the task handler
Classes involved in the demo Manager Handles connecting to the queue and passing results back and forth JobAbstract Abstract class that a job would be based off of Response The response from the manager when a job is queued.  Contains the server name and job number GetRemoteLinks Scans a given web page and reports back a list of all the links on the page
Execution Flow Create job and set data Execute job Job passes itself to the queue manager Manager serializes job Manager uses HTTP call through a load balancer to queue the job The queue on the other end returns the job id and server name Job ID and server name is passed to the client Client polls the manager to get a completed job When the job is returned pass the serialized version of the executed job
Demo
Neato, but how in the world does this pertain to Magento?
How? Long running front-end requests kill front-end responsiveness which kills the user experience 40% will wait no more than 4 seconds for a website (Forrester) Calculating cache data on-the-fly can lead to bad user experiences (abruptly slow page load times) and consistency problems Long running page requests can push up against max_execution_time For example, handling payments from a slow CC API Simply setting it to run longer is a band-aid on a broken bone
Solution? Build Zend Server integration extensions Zendserver_Jobqueue Zendserver_Monitor Utilize the event system to intercept actions Async_Payment  (for payments, in this case) Profit! (scalability AND performance, actually)
Building a job Install the Zend Server Magento extension Create a class that extends Zendserver_Jobqueue_JobAbstract Call $job->execute();
Payment as an example Hooks an observer into controller_action_predispatch_checkout_onepage_saveOrder, core_block_abstract_to_html_after Checks if a defined template is being rendered Injects JavaScript that changes the review.save() method Injects a new URL for submitting the transaction which creates a job Passes POSTed data to a job Job executes by submitting the payment URL on behalf of the browser, storing the result Browser pings the server to see if the job has completed executing yet
Scaling the solution Webserver Job Queue/ Webserver Webserver Load Balancer Job Queue/ Webserver Webserver Job Queue/ Webserver * Duplicate deployments on ALL machines Database or Session Clustering
Downloads Zend Server http://www.zend.com/server Zendserver_Jobqueue https://github.com/kschroeder/Magento-ZendServer-JobQueue Zendserver_Monitor https://github.com/kschroeder/Magento-ZendServer-Monitor Async_Payment https://github.com/kschroeder/Magento-Async-Payment Job Queue library & demo https://github.com/kschroeder/ZendServer-JobQueue-Job-API http://bit.ly/hWJBYw
Magento/Zend Case Study - http://bit.ly/horpFF Follow us! Zend Technologies http://twitter.com/zend http://twitter.com/kpschrade (me!)

Contenu connexe

Tendances

Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Andrew Krug
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Jeremy Likness
 
My XML is Alive! An Intro to XAML
My XML is Alive! An Intro to XAMLMy XML is Alive! An Intro to XAML
My XML is Alive! An Intro to XAMLJeremy Likness
 
Eric Beland Ajax Load Testing Considerations
Eric Beland Ajax Load Testing ConsiderationsEric Beland Ajax Load Testing Considerations
Eric Beland Ajax Load Testing ConsiderationsAjax Experience 2009
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberKMS Technology
 
SQL Server - CLR integration
SQL Server - CLR integrationSQL Server - CLR integration
SQL Server - CLR integrationPeter Gfader
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto PresentationRoy Sivan
 
APIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsAPIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsSauce Labs
 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityIBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityPaul Withers
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWebDave Bouwman
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Web Directions
 
Web performance testing
Web performance testingWeb performance testing
Web performance testingPatrick Meenan
 
Java Enterprise Performance - Unburdended Applications
Java Enterprise Performance - Unburdended ApplicationsJava Enterprise Performance - Unburdended Applications
Java Enterprise Performance - Unburdended ApplicationsLucas Jellema
 
DSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsDSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsMikalai Alimenkou
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Thomas Robbins
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVCLearnNowOnline
 
Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanIssac Goldstand
 
3-TIER ARCHITECTURE IN ASP.NET MVC
3-TIER ARCHITECTURE IN ASP.NET MVC3-TIER ARCHITECTURE IN ASP.NET MVC
3-TIER ARCHITECTURE IN ASP.NET MVCMohd Manzoor Ahmed
 

Tendances (20)

Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
 
My XML is Alive! An Intro to XAML
My XML is Alive! An Intro to XAMLMy XML is Alive! An Intro to XAML
My XML is Alive! An Intro to XAML
 
Eric Beland Ajax Load Testing Considerations
Eric Beland Ajax Load Testing ConsiderationsEric Beland Ajax Load Testing Considerations
Eric Beland Ajax Load Testing Considerations
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
SQL Server - CLR integration
SQL Server - CLR integrationSQL Server - CLR integration
SQL Server - CLR integration
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto Presentation
 
APIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsAPIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page Objects
 
MVC Training Part 2
MVC Training Part 2MVC Training Part 2
MVC Training Part 2
 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityIBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWeb
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5
 
MVC Training Part 1
MVC Training Part 1MVC Training Part 1
MVC Training Part 1
 
Web performance testing
Web performance testingWeb performance testing
Web performance testing
 
Java Enterprise Performance - Unburdended Applications
Java Enterprise Performance - Unburdended ApplicationsJava Enterprise Performance - Unburdended Applications
Java Enterprise Performance - Unburdended Applications
 
DSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsDSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional tests
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & Gearman
 
3-TIER ARCHITECTURE IN ASP.NET MVC
3-TIER ARCHITECTURE IN ASP.NET MVC3-TIER ARCHITECTURE IN ASP.NET MVC
3-TIER ARCHITECTURE IN ASP.NET MVC
 

Similaire à Slideshare - Magento Imagine - Do You Queue

Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?varien
 
Architecting single-page front-end apps
Architecting single-page front-end appsArchitecting single-page front-end apps
Architecting single-page front-end appsZohar Arad
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend FrameworkJuan Antonio
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings10n Software, LLC
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
 
ASP.NET Best Practices - Useful Tips from the Trenches
ASP.NET Best Practices - Useful Tips from the TrenchesASP.NET Best Practices - Useful Tips from the Trenches
ASP.NET Best Practices - Useful Tips from the TrenchesHabeeb Rushdan
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC PresentationVolkan Uzun
 
ASP.NET MVC From The Ground Up
ASP.NET MVC From The Ground UpASP.NET MVC From The Ground Up
ASP.NET MVC From The Ground UpKevin Griffin
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Bruce Johnson
 
Web Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationWeb Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationSupanat Potiwarakorn
 
Scaling PHP Applications with Zend Platform
Scaling PHP Applications with Zend PlatformScaling PHP Applications with Zend Platform
Scaling PHP Applications with Zend PlatformShahar Evron
 
Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbsvarien
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaDavid Chandler
 
Intro to-html-backbone
Intro to-html-backboneIntro to-html-backbone
Intro to-html-backbonezonathen
 
DevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp NetDevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp NetAdil Mughal
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCBarry Gervin
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdfhamzadamani7
 

Similaire à Slideshare - Magento Imagine - Do You Queue (20)

Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
 
North east user group tour
North east user group tourNorth east user group tour
North east user group tour
 
Architecting single-page front-end apps
Architecting single-page front-end appsArchitecting single-page front-end apps
Architecting single-page front-end apps
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
ASP.NET Best Practices - Useful Tips from the Trenches
ASP.NET Best Practices - Useful Tips from the TrenchesASP.NET Best Practices - Useful Tips from the Trenches
ASP.NET Best Practices - Useful Tips from the Trenches
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
ASP.NET MVC From The Ground Up
ASP.NET MVC From The Ground UpASP.NET MVC From The Ground Up
ASP.NET MVC From The Ground Up
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0
 
Web Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationWeb Development Foundation & Team Collaboration
Web Development Foundation & Team Collaboration
 
Scaling PHP Applications with Zend Platform
Scaling PHP Applications with Zend PlatformScaling PHP Applications with Zend Platform
Scaling PHP Applications with Zend Platform
 
Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbs
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
PPT
PPTPPT
PPT
 
Do you queue
Do you queueDo you queue
Do you queue
 
Intro to-html-backbone
Intro to-html-backboneIntro to-html-backbone
Intro to-html-backbone
 
DevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp NetDevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp Net
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf
 

Plus de 10n Software, LLC

Delaying Gratification: Using queues to build efficient systems
Delaying Gratification: Using queues to build efficient systemsDelaying Gratification: Using queues to build efficient systems
Delaying Gratification: Using queues to build efficient systems10n Software, LLC
 
Flex and PHP For the Flash Folks
Flex and PHP For the Flash FolksFlex and PHP For the Flash Folks
Flex and PHP For the Flash Folks10n Software, LLC
 
PHP Performance: Principles and tools
PHP Performance: Principles and toolsPHP Performance: Principles and tools
PHP Performance: Principles and tools10n Software, LLC
 
Application Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 betaApplication Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 beta10n Software, LLC
 
Creating stunning data analytics dashboard using php and flex
Creating stunning data analytics dashboard using php and flexCreating stunning data analytics dashboard using php and flex
Creating stunning data analytics dashboard using php and flex10n Software, LLC
 

Plus de 10n Software, LLC (11)

Delaying Gratification: Using queues to build efficient systems
Delaying Gratification: Using queues to build efficient systemsDelaying Gratification: Using queues to build efficient systems
Delaying Gratification: Using queues to build efficient systems
 
10 things
10 things10 things
10 things
 
Flex and PHP For the Flash Folks
Flex and PHP For the Flash FolksFlex and PHP For the Flash Folks
Flex and PHP For the Flash Folks
 
PHP Performance: Principles and tools
PHP Performance: Principles and toolsPHP Performance: Principles and tools
PHP Performance: Principles and tools
 
Application Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 betaApplication Deployment with Zend Server 5.5 beta
Application Deployment with Zend Server 5.5 beta
 
Flex for php developers
Flex for php developersFlex for php developers
Flex for php developers
 
Creating stunning data analytics dashboard using php and flex
Creating stunning data analytics dashboard using php and flexCreating stunning data analytics dashboard using php and flex
Creating stunning data analytics dashboard using php and flex
 
Php security common 2011
Php security common 2011Php security common 2011
Php security common 2011
 
Zend Server - OSI Days
Zend Server - OSI DaysZend Server - OSI Days
Zend Server - OSI Days
 
Zend Framework Workshop
Zend Framework WorkshopZend Framework Workshop
Zend Framework Workshop
 
Flex and Zend Framework
Flex and Zend FrameworkFlex and Zend Framework
Flex and Zend Framework
 

Dernier

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Slideshare - Magento Imagine - Do You Queue

  • 1. Do you queue? Characteristics of scalability Kevin Schroeder Technology Evangelist Zend Technologies
  • 2. About me Past: Programming/Sys Admin Current: Technology Evangelist/Author/Composer @kpschrade
  • 3. I blog at eschrade.com Follow us! (good things will happen to you) Zend Technologies http://twitter.com/zend http://twitter.com/kpschrade (me!)
  • 4. Twtpoll results Could your PHP apps benefit from being able to process data or execute asynchronously?
  • 5. Why would you want to queue? Performance Execute logic apart from the main request (asynchronicity) Scalability The ability to handle non-immediate logic as resources are available
  • 6. Typical anatomy of a PHP Application Bad for scala-bility! Presentation Application Control Database Access Business Logic Presentation Application Control Business Logic Presentation | 6
  • 7. Good for Scalability Presentation Something.phtml Something.phtml Something.phtml Something.phtml Something.phtml Something.phtml Something.phtml Something.phtml Application Control Something.php Something.php Something.php Something.php Something.php Something.php Something.php Something.php Business Logic Something.php Something.php Something.php Something.php Something.php Something.php Something.php Something.php Database Access Something.php Something.php Something.php Something.php Something.php Something.php Something.php Something.php | 7 | 8-Feb-11
  • 8. What helps make software scalable? Defined tasks Loose coupling Resource discovery
  • 9. The Golden Rule of Scalability “It can probably wait”
  • 10. Asynchronous execution uses Pre-caching data Data analysis Data processing Pre-calculating (preparing data for the next request) Data is “out of date” once it leaves the web server Immediacy is seldom necessary
  • 11. Characteristics A sledgehammer can hit a machine Scalability and High Availability are yin and yang A site that can’t keep running is not scalable A site that can’t scale will fail (if it gets really popular) Machines can be added and removed at will Not “cloudy” necessarily No single point of failure Data exists in at least two, preferably at least three, places
  • 12. Considerations Waste disk space Control usage (don’t let users do anything they want) Pre-calculate as much as possible Calculate and cache/store Keep data processing off the front end servers Don’t just cache Don’t let it substitute for thought Cache hit rates can be meaningless if you have hundreds of cache hits for a request
  • 13.
  • 14. Make as much as possible configurable/discoverableDecouple/Partition Don’t tie everything (relationships and such) into the database Use queues/messaging Stomp interfaces are really good for PHP – Can also use Java Bridge Zend_Queue has several interfaces Try to use stateless interfaces (polling is more scalable than idle connections)
  • 15. Options Use Cron /w PHP CLI (not the best idea) People mostly use cron simply due to availability It’s an available option, not necessarily the best option. Use Gearman Use home-grown (don’t do this) Use pcntl_fork() (NEVER do this) Use Zend Server Job Queue
  • 16. Your only real options Very cloud friendly * I am not an expert on Gearman. Corrections will be taken in the spirit that they are given. For obvious reasons, I will focus on Zend Server
  • 17. Zend Framework Zend Server PHP Application Performance Reliability & Management Scale-Out Business-grade PHP Acceleration Monitoring Clustering Hot Fixes Optimization Root-Cause Job Queue Support Caching Downloads Java Bridge Configuration Linux (rpm/web repositories) IBM i (PTF) Windows (MSI) What the heck is Zend Server? 16 Zend Server
  • 18. Job Queue Architecture – Elastic Backend Web Server /w JQ Web Server Users! Web Server /w JQ Web Server Load Balancer Web Server /w JQ Web Server Pros Scale the backend as necessary Default (easy) mechanism Cons Getting the job status requires using a DB
  • 19. Job Queue Architecture – Elastic Frontend Web Server Web Server /w JQ Users! Web Server Web Server /w JQ Load Balancer Web Server Web Server /w JQ Pros Easy to communicate with the Job Queue server handling the job Cons Requires you to build your own interface (or just use mine!)
  • 20. Kevin’s favorite way to implement it Create a task-handling controller Create an abstract task class Understands the Job Queue Self contained If Elastic Backend: connects to localhost If Elastic Frontend: connects to load balancer (my preferred), load balanced JQ servers manage themselves Execute the task, have it serialize itself and send it to send to the task handler
  • 21. Classes involved in the demo Manager Handles connecting to the queue and passing results back and forth JobAbstract Abstract class that a job would be based off of Response The response from the manager when a job is queued. Contains the server name and job number GetRemoteLinks Scans a given web page and reports back a list of all the links on the page
  • 22. Execution Flow Create job and set data Execute job Job passes itself to the queue manager Manager serializes job Manager uses HTTP call through a load balancer to queue the job The queue on the other end returns the job id and server name Job ID and server name is passed to the client Client polls the manager to get a completed job When the job is returned pass the serialized version of the executed job
  • 23. Demo
  • 24. Neato, but how in the world does this pertain to Magento?
  • 25. How? Long running front-end requests kill front-end responsiveness which kills the user experience 40% will wait no more than 4 seconds for a website (Forrester) Calculating cache data on-the-fly can lead to bad user experiences (abruptly slow page load times) and consistency problems Long running page requests can push up against max_execution_time For example, handling payments from a slow CC API Simply setting it to run longer is a band-aid on a broken bone
  • 26. Solution? Build Zend Server integration extensions Zendserver_Jobqueue Zendserver_Monitor Utilize the event system to intercept actions Async_Payment (for payments, in this case) Profit! (scalability AND performance, actually)
  • 27. Building a job Install the Zend Server Magento extension Create a class that extends Zendserver_Jobqueue_JobAbstract Call $job->execute();
  • 28. Payment as an example Hooks an observer into controller_action_predispatch_checkout_onepage_saveOrder, core_block_abstract_to_html_after Checks if a defined template is being rendered Injects JavaScript that changes the review.save() method Injects a new URL for submitting the transaction which creates a job Passes POSTed data to a job Job executes by submitting the payment URL on behalf of the browser, storing the result Browser pings the server to see if the job has completed executing yet
  • 29. Scaling the solution Webserver Job Queue/ Webserver Webserver Load Balancer Job Queue/ Webserver Webserver Job Queue/ Webserver * Duplicate deployments on ALL machines Database or Session Clustering
  • 30. Downloads Zend Server http://www.zend.com/server Zendserver_Jobqueue https://github.com/kschroeder/Magento-ZendServer-JobQueue Zendserver_Monitor https://github.com/kschroeder/Magento-ZendServer-Monitor Async_Payment https://github.com/kschroeder/Magento-Async-Payment Job Queue library & demo https://github.com/kschroeder/ZendServer-JobQueue-Job-API http://bit.ly/hWJBYw
  • 31. Magento/Zend Case Study - http://bit.ly/horpFF Follow us! Zend Technologies http://twitter.com/zend http://twitter.com/kpschrade (me!)
  • 32. Get this information and all the examples at eschrade.com…

Notes de l'éditeur

  1. We released Zend Server and Zend Server Community Edition in April this year Products written from scratch based on our very extensive experience with Platform technologies Full integrated stack, native installer, ZF and Studio integration, software updates, all new UI, … Both editions have been very well received by users (love performance boost, ease of use, deployment) Great fit to our partners – we’re working with Varien/Magento, KnowledgeTree, MCS, … Next step will round up web app server offering to support high availability and scalability – more on this in the next few months