SlideShare una empresa de Scribd logo
1 de 26
Do you queue?
Characteristics of
scalability
Kevin Schroeder
Technology Evangelist
Zend Technologies
2
•Kevin Schroeder
 Technology Evangelist for Zend
 Programmer
 Sys Admin
 Author
• IBM i Programmer’s Guide to PHP
• You want to do WHAT with PHP?
 Race Ferraris on the weekend
• My Honda has a dismal win record
About me
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
Could your PHP apps benefit from being able to
process data or execute asynchronously?
Twtpoll results
5
•Performance
 Execute logic apart from the main request (asynchronicity)
•Scalability
 The ability to handle non-immediate logic as resources are
available
Why would you want to queue?
6
•People often say that performance and scalability are two
completely different things.
This is inaccurate
•Performance is the speed by which a request is executed
•Scalability is the ability of that request to maintain its
performance as load/infrastructure increases
Performance & Scalability
7
•DON’T!!
•You are not Facebook
•You probably won’t be
•Don’t overcomplicate your problems by trying to be
So how do you scale to Facebook size?
8
Typical anatomy of a PHP Application
|
Presentation
Application Control
Database Access
Business Logic
Presentation
Application Control
Business Logic
Presentation
Bad for
scala-
bility!
9| |
Presentation
Database Access
Business Logic
Application Control
Someth
ing.pht
ml
Someth
ing.pht
ml
Someth
ing.pht
ml
Someth
ing.pht
ml
Someth
ing.pht
ml
Someth
ing.pht
ml
Someth
ing.pht
ml
Someth
ing.pht
ml
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Someth
ing.php
Good for
Scalability
10
Defined tasks
Loose coupling
Resource discovery
What helps make software scalable?
11
The Golden Rule of Scalability
“It can probably wait”
12
•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
Asynchronous execution uses
13
•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
Characteristics
14
•Waste disk space
•Control usage (don’t let users do anything they want)
•Pre-calculate as much as possible
 Calculate and cache/store
•Don’t scan large amounts of data
•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
15
• Build a deployment mechanism with NO hardcoded values
like directory or resource locations
• Make as much as possible configurable/discoverable
•Decouple/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)
Considerations
16
•Use Cron /w PHP CLI (probably shouldn’t do this)
•Use Gearman
•Use home-grown (don’t do this)
•Use pcntl_fork() (NEVER do this)
•Use Zend Server Job Queue
Options
17
Gearman* Zend Server Job Queue
Free
Lightweight
Open Source
(mostly) language
agnostic
Distributed queuing
Ready to go
Integrates with Event Monitoring
Integrates with Code Tracing
Runs over a widely known protocol
Load distribution can be
accomplished outside of the queue
Your only real options
* I am not an expert on Gearman. Corrections will be taken in the spirit that they are given.
Very cloud friendly
For obvious reasons, I will focus on Zend Server
18
•Schedule jobs in the future
•Set recurring jobs
•Execute immediately, as resources are available (my fav)
•Utilize ZendJobQueue()
Using the Zend Server Job Queue
19
Job Queue Architecture – Elastic Backend
Users!
Web Server
/w JQ
Web Server
/w JQ
Web Server
/w JQ
Web Server
Web Server
Web Server
LoadBalancer
•Pros
 Scale the backend as necessary
 Default (easy) mechanism
•Cons
 Getting the job status requires using a DB
20
Job Queue Architecture – Elastic Frontend
Users!
Web Server
Web Server
Web Server
Web Server
/w JQ
Web Server
/w JQ
Web Server
/w JQ
LoadBalancer
•Pros
• Easy to communicate with the Job Queue server handling the job
Cons
• Requires you to build your own interface
21
•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
Kevin’s favorite way to implement it
22
 Q_Manager
Handles connecting to the queue and passing results back and forth
 Q_JobAbstract
Abstract class that a job would be based off of
 Q_Response
The response from the manager when a job is queued. Contains the
server name and job number
 Job_Scandir
The actual job that scans the directory
 Job_ScandirResult
An object that represents the data found
Classes involved in the demo
23
 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
Execution Flow
24
Let’s write some code
(no I’m not copping out with slides. We’re all told to show our work in
grade scool)
25
Follow us!
 Zend Technologies
 http://twitter.com/zend
 http://twitter.com/kpschrade (me!)
26
Get this information and all the
examples at eschrade.com…

Más contenido relacionado

La actualidad más candente

Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?Weng Wei
 
Azkaban-en
Azkaban-enAzkaban-en
Azkaban-enwyukawa
 
Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.Herman Peeren
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 
RubyConf Taiwan 2016 - Large scale Rails applications
RubyConf Taiwan 2016 - Large scale Rails applicationsRubyConf Taiwan 2016 - Large scale Rails applications
RubyConf Taiwan 2016 - Large scale Rails applicationsFlorian Dutey
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friendFilip Bruun Bech-Larsen
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applicationsEugene Lazutkin
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Edmund Turbin
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4Derek Jacoby
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS DebuggingRami Sayar
 
Talk about java
Talk about javaTalk about java
Talk about javaDavis Chen
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part IIEugene Lazutkin
 
Untangling - fall2017 - week 10
Untangling - fall2017 - week 10Untangling - fall2017 - week 10
Untangling - fall2017 - week 10Derek Jacoby
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With JestBen McCormick
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoWeng Wei
 
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Mike Schinkel
 
Performance metrics for a social network
Performance metrics for a social networkPerformance metrics for a social network
Performance metrics for a social networkThierry Schellenbach
 

La actualidad más candente (20)

Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?
 
Azkaban-en
Azkaban-enAzkaban-en
Azkaban-en
 
Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
A Day of REST
A Day of RESTA Day of REST
A Day of REST
 
RubyConf Taiwan 2016 - Large scale Rails applications
RubyConf Taiwan 2016 - Large scale Rails applicationsRubyConf Taiwan 2016 - Large scale Rails applications
RubyConf Taiwan 2016 - Large scale Rails applications
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friend
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
Frameworks and webcomponents
Frameworks and webcomponentsFrameworks and webcomponents
Frameworks and webcomponents
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS Debugging
 
Untangling11
Untangling11Untangling11
Untangling11
 
Talk about java
Talk about javaTalk about java
Talk about java
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
Untangling - fall2017 - week 10
Untangling - fall2017 - week 10Untangling - fall2017 - week 10
Untangling - fall2017 - week 10
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to Go
 
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)
 
Performance metrics for a social network
Performance metrics for a social networkPerformance metrics for a social network
Performance metrics for a social network
 

Similar a Do you queue

BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesJonathan Klein
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterpriseBest practices-wordpress-enterprise
Best practices-wordpress-enterpriseTaylor Lovett
 
Best Practices for WordPress in Enterprise
Best Practices for WordPress in EnterpriseBest Practices for WordPress in Enterprise
Best Practices for WordPress in EnterpriseTaylor Lovett
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i Zend by Rogue Wave Software
 
Slideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You QueueSlideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You Queue10n Software, LLC
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPressTaylor Lovett
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravelDerek Binkley
 
Headless cms architecture
Headless cms architectureHeadless cms architecture
Headless cms architectureKevin Wenger
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsTaylor Lovett
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 
Scaling a High Traffic Web Application: Our Journey from Java to PHP
Scaling a High Traffic Web Application: Our Journey from Java to PHPScaling a High Traffic Web Application: Our Journey from Java to PHP
Scaling a High Traffic Web Application: Our Journey from Java to PHP120bi
 
Scaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsScaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsAchievers Tech
 
Untangling spring week1
Untangling spring week1Untangling spring week1
Untangling spring week1Derek Jacoby
 
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 PotsdamFrom Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 PotsdamAndreas Grabner
 
GraphQL-PHP: Dos and don'ts
GraphQL-PHP: Dos and don'tsGraphQL-PHP: Dos and don'ts
GraphQL-PHP: Dos and don'tsVáclav Šír
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleMike Willbanks
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your WebsiteAcquia
 

Similar a Do you queue (20)

Do you queue (updated)
Do you queue (updated)Do you queue (updated)
Do you queue (updated)
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterpriseBest practices-wordpress-enterprise
Best practices-wordpress-enterprise
 
Best Practices for WordPress in Enterprise
Best Practices for WordPress in EnterpriseBest Practices for WordPress in Enterprise
Best Practices for WordPress in Enterprise
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 
Slideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You QueueSlideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You Queue
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPress
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravel
 
Voldemort Nosql
Voldemort NosqlVoldemort Nosql
Voldemort Nosql
 
Headless cms architecture
Headless cms architectureHeadless cms architecture
Headless cms architecture
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
 
North east user group tour
North east user group tourNorth east user group tour
North east user group tour
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Scaling a High Traffic Web Application: Our Journey from Java to PHP
Scaling a High Traffic Web Application: Our Journey from Java to PHPScaling a High Traffic Web Application: Our Journey from Java to PHP
Scaling a High Traffic Web Application: Our Journey from Java to PHP
 
Scaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsScaling High Traffic Web Applications
Scaling High Traffic Web Applications
 
Untangling spring week1
Untangling spring week1Untangling spring week1
Untangling spring week1
 
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 PotsdamFrom Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
From Zero to Performance Hero in Minutes - Agile Testing Days 2014 Potsdam
 
GraphQL-PHP: Dos and don'ts
GraphQL-PHP: Dos and don'tsGraphQL-PHP: Dos and don'ts
GraphQL-PHP: Dos and don'ts
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for Scale
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 

Más 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
 
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
 

Más de 10n Software, LLC (12)

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
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings
 
Flex and Zend Framework
Flex and Zend FrameworkFlex and Zend Framework
Flex and Zend Framework
 

Último

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Último (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Do you queue

  • 1. Do you queue? Characteristics of scalability Kevin Schroeder Technology Evangelist Zend Technologies
  • 2. 2 •Kevin Schroeder  Technology Evangelist for Zend  Programmer  Sys Admin  Author • IBM i Programmer’s Guide to PHP • You want to do WHAT with PHP?  Race Ferraris on the weekend • My Honda has a dismal win record About me
  • 3. 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. 4 Could your PHP apps benefit from being able to process data or execute asynchronously? Twtpoll results
  • 5. 5 •Performance  Execute logic apart from the main request (asynchronicity) •Scalability  The ability to handle non-immediate logic as resources are available Why would you want to queue?
  • 6. 6 •People often say that performance and scalability are two completely different things. This is inaccurate •Performance is the speed by which a request is executed •Scalability is the ability of that request to maintain its performance as load/infrastructure increases Performance & Scalability
  • 7. 7 •DON’T!! •You are not Facebook •You probably won’t be •Don’t overcomplicate your problems by trying to be So how do you scale to Facebook size?
  • 8. 8 Typical anatomy of a PHP Application | Presentation Application Control Database Access Business Logic Presentation Application Control Business Logic Presentation Bad for scala- bility!
  • 9. 9| | Presentation Database Access Business Logic Application Control Someth ing.pht ml Someth ing.pht ml Someth ing.pht ml Someth ing.pht ml Someth ing.pht ml Someth ing.pht ml Someth ing.pht ml Someth ing.pht ml Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Someth ing.php Good for Scalability
  • 10. 10 Defined tasks Loose coupling Resource discovery What helps make software scalable?
  • 11. 11 The Golden Rule of Scalability “It can probably wait”
  • 12. 12 •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 Asynchronous execution uses
  • 13. 13 •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 Characteristics
  • 14. 14 •Waste disk space •Control usage (don’t let users do anything they want) •Pre-calculate as much as possible  Calculate and cache/store •Don’t scan large amounts of data •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
  • 15. 15 • Build a deployment mechanism with NO hardcoded values like directory or resource locations • Make as much as possible configurable/discoverable •Decouple/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) Considerations
  • 16. 16 •Use Cron /w PHP CLI (probably shouldn’t do this) •Use Gearman •Use home-grown (don’t do this) •Use pcntl_fork() (NEVER do this) •Use Zend Server Job Queue Options
  • 17. 17 Gearman* Zend Server Job Queue Free Lightweight Open Source (mostly) language agnostic Distributed queuing Ready to go Integrates with Event Monitoring Integrates with Code Tracing Runs over a widely known protocol Load distribution can be accomplished outside of the queue Your only real options * I am not an expert on Gearman. Corrections will be taken in the spirit that they are given. Very cloud friendly For obvious reasons, I will focus on Zend Server
  • 18. 18 •Schedule jobs in the future •Set recurring jobs •Execute immediately, as resources are available (my fav) •Utilize ZendJobQueue() Using the Zend Server Job Queue
  • 19. 19 Job Queue Architecture – Elastic Backend Users! Web Server /w JQ Web Server /w JQ Web Server /w JQ Web Server Web Server Web Server LoadBalancer •Pros  Scale the backend as necessary  Default (easy) mechanism •Cons  Getting the job status requires using a DB
  • 20. 20 Job Queue Architecture – Elastic Frontend Users! Web Server Web Server Web Server Web Server /w JQ Web Server /w JQ Web Server /w JQ LoadBalancer •Pros • Easy to communicate with the Job Queue server handling the job Cons • Requires you to build your own interface
  • 21. 21 •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 Kevin’s favorite way to implement it
  • 22. 22  Q_Manager Handles connecting to the queue and passing results back and forth  Q_JobAbstract Abstract class that a job would be based off of  Q_Response The response from the manager when a job is queued. Contains the server name and job number  Job_Scandir The actual job that scans the directory  Job_ScandirResult An object that represents the data found Classes involved in the demo
  • 23. 23  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 Execution Flow
  • 24. 24 Let’s write some code (no I’m not copping out with slides. We’re all told to show our work in grade scool)
  • 25. 25 Follow us!  Zend Technologies  http://twitter.com/zend  http://twitter.com/kpschrade (me!)
  • 26. 26 Get this information and all the examples at eschrade.com…