SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Architecting with Queues for
Scale, Speed and Separation
Sandy Smith
DCPHP 3/11/15
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
The Challenge
2
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Social Contest
•Show off Azure + PHP
•People submit tweets to enter contest
•Pull specified keywords from Twitter queue (prefiltered by
Node.js app)
•Human admins filter out inappropriate content
•Humans or computer pulls out winner from approved entries,
on timer or arbitrarily
•Display latest entries and latest winners to public
3
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Stretch goals
•Allow any size contest
•Assume global contest with distributed moderators
4
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Initial design
5
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
The real bottleneck
What’s the slowest and
most variable part of any
application?
6
Insert Text Here
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
The real bottleneck
7
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Quick refresher
Performance vs. Scaling

Vertical vs. Horizontal Scaling
8
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Traditional database design
•Group by kind
•Keep metadata with object or in metadata tables
•Objects (Document, Person, Account) are most important
•Reinforced by TableGateway, ActiveRecord patterns, and ORM
and framework module generator defaults
•Works for 80% of cases
9
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Tradeoffs of traditional design
•Everything’s in one table, even when you routinely only need a
subset
•Typically one master writes, replicants read
•Design is focused around what something is, not its state or
other attribute
•Requires creative solutions for horizontal scaling
•Encourages (but does not require) centralizing logic for a given
type of data
10
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Worst of all…
•This design really didn’t show off all the stuff in Azure
11
(We had a week left)
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Redesign time
12
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Redesign goals
•Include as much Azure stuff as is reasonable
•Implement the stretch goals of scalability
13
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Queues to the rescue!
(Plus some other cool stuff)
14
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
New approach
•Keep long term but fast storage
•Central concern is not the Thing (Entry) but Status
– Unapproved

– Approved

– Denied

– Winner

•Separate updates to long term storage from status changes
•Minimal impact to working code
15
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Azure queuing options
Azure Queues (duh)
•Simple
•“Short”-lived (<7 days)
•Used within Azure
•Uses REST
•Can track message
processing
16
Azure Service Bus
•Enterprisey
•Long-lived
•In Azure or private cloud
•Can use AMQP, REST, or
API
•Can publish/subscribe
•Can batch requests
•Can guarantee FIFO
•etc.
See https://msdn.microsoft.com/en-us/library/azure/hh767287.aspx
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
More options
•Anything you can install on Linux or Windows (RabbitMQ,
ZeroMQ, Kafka, Kestrel, ActiveMQ, etc.)
•Any relational or NoSQL database
•Azure Tables - Simple REST NoSQL store with a twist
17
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Solutions
•Long term storage and display retrieval: Azure Table
•Since entries could begin long before a conference, use
Service Bus to store changes in status
•Have daemons pull incoming status changes out and write
them to the Table
18
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
New design
19
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Azure Table basics
20
require_once 'vendorautoload.php';

use WindowsAzureCommonServicesBuilder;

use WindowsAzureCommonServiceException;

use WindowsAzureTableModelsEntity;

use WindowsAzureTableModelsEdmType;



// Create table REST proxy.

$tableRestProxy = ServicesBuilder::getInstance()->createTableService($connectionString);



try {

// Create table.

$tableRestProxy->createTable("mytable");

} catch(ServiceException $e){

// Handle exception based on error codes and messages.

}



$entity = new Entity();

$entity->setPartitionKey("pk");

$entity->setRowKey("1");

$entity->addProperty("PropertyName", EdmType::STRING, "Sample");



try {

$tableRestProxy->insertEntity("mytable", $entity);

} catch(ServiceException $e){

// Handle exception based on error codes and messages.

}
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Create and send with Service Bus
21
require_once 'vendorautoload.php';

use WindowsAzureServiceBusModelsQueueInfo;

use WindowsAzureCommonServiceException;

use WindowsAzureCommonServicesBuilder;



$serviceBusRestProxy = ServicesBuilder::getInstance()-
>createServiceBusService($connectionString);



try {

$queueInfo = new QueueInfo("myqueue");

$serviceBusRestProxy->createQueue($queueInfo);

} catch(ServiceException $e) {

// handle error

}



try {

// Create message.

$message = new BrokeredMessage();

$message->setBody("my message");



// Send message.

$serviceBusRestProxy->sendQueueMessage("myqueue", $message);

} catch(ServiceException $e) {

// handle error

}
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Receive with Service Bus
22
require_once 'vendorautoload.php';

use WindowsAzureServiceBusModelsQueueInfo;

use WindowsAzureCommonServiceException;

use WindowsAzureCommonServicesBuilder;



$serviceBusRestProxy = ServicesBuilder::getInstance()-
>createServiceBusService($connectionString);



try {

// Set the receive mode to PeekLock (default is ReceiveAndDelete).

$options = new ReceiveMessageOptions();

$options->setPeekLock(true);



// Receive message.

$message = $serviceBusRestProxy->receiveQueueMessage("myqueue", $options);

echo "Body: ".$message->getBody()."<br />";

echo "MessageID: ".$message->getMessageId()."<br />";



// *** Process message here ***



// Delete message.

$serviceBusRestProxy->deleteMessage($message);

} catch(ServiceException $e){

// handle error

}
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Benefits
•Queues add safety: if processing fails, main store is unchanged
•App doesn’t wait for process-update-delete cycle
– Concerns more separated

•Can move queue processing to separate machines
•Trivial to move to different stores for each status
•Very performant with up-to-second data
23
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Challenges
•No full ACID
•Safety is largely in the application layer
•Potential for race conditions
– Humans suck
24
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Takeaways
•Look for more than just long processes
•Use to decouple functions
•Look for status changes
•Is the type of data the most important aspect of your data?
– It usually is!

•Design for replacement of components
– Makes changes easier (not easy)
25
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Links
•Azure: http://azure.microsoft.com/en-us/
•Social Contest:

https://github.com/MusketeersMe/SocialContest
•Me
– @SandyS1

– http://phparch.com/

•Feedback! https://joind.in/event/dc-php-march-2015
•Lone Star PHP (April 16–18): http://lonestarphp.com
•php[tek] (May 18–22) http://tek.phparch.com
•Slides will be at: http://www.slideshare.net/SandySmith
26
Architecting with Queues - Sandy Smith - DCPHP - 3/11/15
Image credits
•Questions? by Valerie Everett

https://flic.kr/p/5zEjFG
•Expanded coke zero can! by Audin Malmin

https://flic.kr/p/5Ldjx8
27

Weitere ähnliche Inhalte

Was ist angesagt?

Windows Azure Drive
Windows Azure DriveWindows Azure Drive
Windows Azure DrivePavel Revenkov
 
Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Jelastic Multi-Cloud PaaS
 
Atom: A cloud native deep learning platform at Supremind
Atom: A cloud native deep learning platform at SupremindAtom: A cloud native deep learning platform at Supremind
Atom: A cloud native deep learning platform at SupremindAlluxio, Inc.
 
Storage Services
Storage ServicesStorage Services
Storage ServicesPavel Revenkov
 
Paul Angus - CloudStack Container Service
Paul  Angus - CloudStack Container ServicePaul  Angus - CloudStack Container Service
Paul Angus - CloudStack Container ServiceShapeBlue
 
Performance tuning in BlueStore & RocksDB - Li Xiaoyan
Performance tuning in BlueStore & RocksDB - Li XiaoyanPerformance tuning in BlueStore & RocksDB - Li Xiaoyan
Performance tuning in BlueStore & RocksDB - Li XiaoyanCeph Community
 
Bacd zenoss
Bacd zenossBacd zenoss
Bacd zenosske4qqq
 
Integration of Glusterfs in to commvault simpana
Integration of Glusterfs in to commvault simpanaIntegration of Glusterfs in to commvault simpana
Integration of Glusterfs in to commvault simpanaGluster.org
 
Drupal performance optimization Best Practices
Drupal performance optimization Best PracticesDrupal performance optimization Best Practices
Drupal performance optimization Best PracticesRatnesh kumar, CSM
 
Architectural patterns for high performance microservices in kubernetes
Architectural patterns for high performance microservices in kubernetesArchitectural patterns for high performance microservices in kubernetes
Architectural patterns for high performance microservices in kubernetesRafał Leszko
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordPhil Pursglove
 
CEPH DAY BERLIN - CEPH MANAGEMENT THE EASY AND RELIABLE WAY
CEPH DAY BERLIN - CEPH MANAGEMENT THE EASY AND RELIABLE WAYCEPH DAY BERLIN - CEPH MANAGEMENT THE EASY AND RELIABLE WAY
CEPH DAY BERLIN - CEPH MANAGEMENT THE EASY AND RELIABLE WAYCeph Community
 
Adam Dagnall: Advanced S3 compatible storage integration in CloudStack
Adam Dagnall: Advanced S3 compatible storage integration in CloudStackAdam Dagnall: Advanced S3 compatible storage integration in CloudStack
Adam Dagnall: Advanced S3 compatible storage integration in CloudStackShapeBlue
 
Kubernetes #2 monitoring
Kubernetes #2   monitoring Kubernetes #2   monitoring
Kubernetes #2 monitoring Terry Cho
 
Architectural caching patterns for kubernetes
Architectural caching patterns for kubernetesArchitectural caching patterns for kubernetes
Architectural caching patterns for kubernetesRafał Leszko
 
Red Hat Gluster Storage, Container Storage and CephFS Plans
Red Hat Gluster Storage, Container Storage and CephFS PlansRed Hat Gluster Storage, Container Storage and CephFS Plans
Red Hat Gluster Storage, Container Storage and CephFS PlansRed_Hat_Storage
 
Architecting with Queues - Northeast PHP 2015
Architecting with Queues - Northeast PHP 2015Architecting with Queues - Northeast PHP 2015
Architecting with Queues - Northeast PHP 2015Sandy Smith
 
Redis Labs and SQL Server
Redis Labs and SQL ServerRedis Labs and SQL Server
Redis Labs and SQL ServerLynn Langit
 
Device Synchronization with Javascript and PouchDB
Device Synchronization with Javascript and PouchDBDevice Synchronization with Javascript and PouchDB
Device Synchronization with Javascript and PouchDBFrank Rousseau
 
Sdc challenges-2012
Sdc challenges-2012Sdc challenges-2012
Sdc challenges-2012Gluster.org
 

Was ist angesagt? (20)

Windows Azure Drive
Windows Azure DriveWindows Azure Drive
Windows Azure Drive
 
Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...
 
Atom: A cloud native deep learning platform at Supremind
Atom: A cloud native deep learning platform at SupremindAtom: A cloud native deep learning platform at Supremind
Atom: A cloud native deep learning platform at Supremind
 
Storage Services
Storage ServicesStorage Services
Storage Services
 
Paul Angus - CloudStack Container Service
Paul  Angus - CloudStack Container ServicePaul  Angus - CloudStack Container Service
Paul Angus - CloudStack Container Service
 
Performance tuning in BlueStore & RocksDB - Li Xiaoyan
Performance tuning in BlueStore & RocksDB - Li XiaoyanPerformance tuning in BlueStore & RocksDB - Li Xiaoyan
Performance tuning in BlueStore & RocksDB - Li Xiaoyan
 
Bacd zenoss
Bacd zenossBacd zenoss
Bacd zenoss
 
Integration of Glusterfs in to commvault simpana
Integration of Glusterfs in to commvault simpanaIntegration of Glusterfs in to commvault simpana
Integration of Glusterfs in to commvault simpana
 
Drupal performance optimization Best Practices
Drupal performance optimization Best PracticesDrupal performance optimization Best Practices
Drupal performance optimization Best Practices
 
Architectural patterns for high performance microservices in kubernetes
Architectural patterns for high performance microservices in kubernetesArchitectural patterns for high performance microservices in kubernetes
Architectural patterns for high performance microservices in kubernetes
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen Oxford
 
CEPH DAY BERLIN - CEPH MANAGEMENT THE EASY AND RELIABLE WAY
CEPH DAY BERLIN - CEPH MANAGEMENT THE EASY AND RELIABLE WAYCEPH DAY BERLIN - CEPH MANAGEMENT THE EASY AND RELIABLE WAY
CEPH DAY BERLIN - CEPH MANAGEMENT THE EASY AND RELIABLE WAY
 
Adam Dagnall: Advanced S3 compatible storage integration in CloudStack
Adam Dagnall: Advanced S3 compatible storage integration in CloudStackAdam Dagnall: Advanced S3 compatible storage integration in CloudStack
Adam Dagnall: Advanced S3 compatible storage integration in CloudStack
 
Kubernetes #2 monitoring
Kubernetes #2   monitoring Kubernetes #2   monitoring
Kubernetes #2 monitoring
 
Architectural caching patterns for kubernetes
Architectural caching patterns for kubernetesArchitectural caching patterns for kubernetes
Architectural caching patterns for kubernetes
 
Red Hat Gluster Storage, Container Storage and CephFS Plans
Red Hat Gluster Storage, Container Storage and CephFS PlansRed Hat Gluster Storage, Container Storage and CephFS Plans
Red Hat Gluster Storage, Container Storage and CephFS Plans
 
Architecting with Queues - Northeast PHP 2015
Architecting with Queues - Northeast PHP 2015Architecting with Queues - Northeast PHP 2015
Architecting with Queues - Northeast PHP 2015
 
Redis Labs and SQL Server
Redis Labs and SQL ServerRedis Labs and SQL Server
Redis Labs and SQL Server
 
Device Synchronization with Javascript and PouchDB
Device Synchronization with Javascript and PouchDBDevice Synchronization with Javascript and PouchDB
Device Synchronization with Javascript and PouchDB
 
Sdc challenges-2012
Sdc challenges-2012Sdc challenges-2012
Sdc challenges-2012
 

Andere mochten auch

Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Sandy Smith
 
TDA Center Depok update 2014 (Concept)
TDA Center Depok update 2014 (Concept)TDA Center Depok update 2014 (Concept)
TDA Center Depok update 2014 (Concept)Herri Setiawan
 
Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014Sandy Smith
 
Unicode Regular Expressions
Unicode Regular ExpressionsUnicode Regular Expressions
Unicode Regular ExpressionsNova Patch
 
Multibyte string handling in PHP
Multibyte string handling in PHPMultibyte string handling in PHP
Multibyte string handling in PHPDaniel_Rhodes
 
GAIQ - Regular expressions-google-analytics
GAIQ - Regular expressions-google-analyticsGAIQ - Regular expressions-google-analytics
GAIQ - Regular expressions-google-analyticsAnkita Kishore
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsdavidfstr
 
Hyperlocalisation or "localising everything"
Hyperlocalisation or "localising everything"Hyperlocalisation or "localising everything"
Hyperlocalisation or "localising everything"Daniel_Rhodes
 
Lessons from a Dying CMS
Lessons from a Dying CMSLessons from a Dying CMS
Lessons from a Dying CMSSandy Smith
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsJames Gray
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsNicole Ryan
 
Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014
Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014
Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014Sandy Smith
 
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?daoswald
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQLNicole Ryan
 
How to report a bug
How to report a bugHow to report a bug
How to report a bugSandy Smith
 
Don't Fear the Regex - Northeast PHP 2015
Don't Fear the Regex - Northeast PHP 2015Don't Fear the Regex - Northeast PHP 2015
Don't Fear the Regex - Northeast PHP 2015Sandy Smith
 
Learning Regular Expressions for the Extraction of Product Attributes from E-...
Learning Regular Expressions for the Extraction of Product Attributes from E-...Learning Regular Expressions for the Extraction of Product Attributes from E-...
Learning Regular Expressions for the Extraction of Product Attributes from E-...Volha Bryl
 

Andere mochten auch (20)

Intoduction to php strings
Intoduction to php  stringsIntoduction to php  strings
Intoduction to php strings
 
Grokking regex
Grokking regexGrokking regex
Grokking regex
 
Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15
 
TDA Center Depok update 2014 (Concept)
TDA Center Depok update 2014 (Concept)TDA Center Depok update 2014 (Concept)
TDA Center Depok update 2014 (Concept)
 
Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014
 
Unicode Regular Expressions
Unicode Regular ExpressionsUnicode Regular Expressions
Unicode Regular Expressions
 
Multibyte string handling in PHP
Multibyte string handling in PHPMultibyte string handling in PHP
Multibyte string handling in PHP
 
GAIQ - Regular expressions-google-analytics
GAIQ - Regular expressions-google-analyticsGAIQ - Regular expressions-google-analytics
GAIQ - Regular expressions-google-analytics
 
Dom
DomDom
Dom
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Hyperlocalisation or "localising everything"
Hyperlocalisation or "localising everything"Hyperlocalisation or "localising everything"
Hyperlocalisation or "localising everything"
 
Lessons from a Dying CMS
Lessons from a Dying CMSLessons from a Dying CMS
Lessons from a Dying CMS
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014
Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014
Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014
 
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
 
How to report a bug
How to report a bugHow to report a bug
How to report a bug
 
Don't Fear the Regex - Northeast PHP 2015
Don't Fear the Regex - Northeast PHP 2015Don't Fear the Regex - Northeast PHP 2015
Don't Fear the Regex - Northeast PHP 2015
 
Learning Regular Expressions for the Extraction of Product Attributes from E-...
Learning Regular Expressions for the Extraction of Product Attributes from E-...Learning Regular Expressions for the Extraction of Product Attributes from E-...
Learning Regular Expressions for the Extraction of Product Attributes from E-...
 

Ähnlich wie Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)

Troubleshooting a XenDesktop Environment using the PowerShell SDK
Troubleshooting a XenDesktop Environment using the PowerShell SDKTroubleshooting a XenDesktop Environment using the PowerShell SDK
Troubleshooting a XenDesktop Environment using the PowerShell SDKDavid McGeough
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisationgrooverdan
 
Tips, Tricks & Best Practices for large scale HDInsight Deployments
Tips, Tricks & Best Practices for large scale HDInsight DeploymentsTips, Tricks & Best Practices for large scale HDInsight Deployments
Tips, Tricks & Best Practices for large scale HDInsight DeploymentsAshish Thapliyal
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesDoris Chen
 
Advanced iOS Build Mechanics, Sebastien Pouliot
Advanced iOS Build Mechanics, Sebastien PouliotAdvanced iOS Build Mechanics, Sebastien Pouliot
Advanced iOS Build Mechanics, Sebastien PouliotXamarin
 
Performance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesDoris Chen
 
Real-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
Real-Time Streaming: Move IMS Data to Your Cloud Data WarehouseReal-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
Real-Time Streaming: Move IMS Data to Your Cloud Data WarehousePrecisely
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
Dok Talks #124 - Intro to Druid on Kubernetes
Dok Talks #124 - Intro to Druid on KubernetesDok Talks #124 - Intro to Druid on Kubernetes
Dok Talks #124 - Intro to Druid on KubernetesDoKC
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetAchieve Internet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetAchieve Internet
 
Dsdt meetup 2017 11-21
Dsdt meetup 2017 11-21Dsdt meetup 2017 11-21
Dsdt meetup 2017 11-21JDA Labs MTL
 
DSDT Meetup Nov 2017
DSDT Meetup Nov 2017DSDT Meetup Nov 2017
DSDT Meetup Nov 2017DSDT_MTL
 
Speed up R with parallel programming in the Cloud
Speed up R with parallel programming in the CloudSpeed up R with parallel programming in the Cloud
Speed up R with parallel programming in the CloudRevolution Analytics
 
Performance and Scale: Billions of request per day (DDD2019)
Performance and Scale: Billions of request per day (DDD2019)Performance and Scale: Billions of request per day (DDD2019)
Performance and Scale: Billions of request per day (DDD2019)Marcel Dempers
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesDataWorks Summit
 
XPDS13: Xen and XenServer Storage Performance - Felipe Franciosi, Citrix
XPDS13: Xen and XenServer Storage Performance - Felipe Franciosi, CitrixXPDS13: Xen and XenServer Storage Performance - Felipe Franciosi, Citrix
XPDS13: Xen and XenServer Storage Performance - Felipe Franciosi, CitrixThe Linux Foundation
 
Splitgraph: AHL talk
Splitgraph: AHL talkSplitgraph: AHL talk
Splitgraph: AHL talkSplitgraph
 
E2E PVS Technical Overview Stephane Thirion
E2E PVS Technical Overview Stephane ThirionE2E PVS Technical Overview Stephane Thirion
E2E PVS Technical Overview Stephane Thirionsthirion
 

Ähnlich wie Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15) (20)

Troubleshooting a XenDesktop Environment using the PowerShell SDK
Troubleshooting a XenDesktop Environment using the PowerShell SDKTroubleshooting a XenDesktop Environment using the PowerShell SDK
Troubleshooting a XenDesktop Environment using the PowerShell SDK
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisation
 
Tips, Tricks & Best Practices for large scale HDInsight Deployments
Tips, Tricks & Best Practices for large scale HDInsight DeploymentsTips, Tricks & Best Practices for large scale HDInsight Deployments
Tips, Tricks & Best Practices for large scale HDInsight Deployments
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best Practices
 
Advanced iOS Build Mechanics, Sebastien Pouliot
Advanced iOS Build Mechanics, Sebastien PouliotAdvanced iOS Build Mechanics, Sebastien Pouliot
Advanced iOS Build Mechanics, Sebastien Pouliot
 
Performance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best Practices
 
Real-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
Real-Time Streaming: Move IMS Data to Your Cloud Data WarehouseReal-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
Real-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
BigData Developers MeetUp
BigData Developers MeetUpBigData Developers MeetUp
BigData Developers MeetUp
 
Dok Talks #124 - Intro to Druid on Kubernetes
Dok Talks #124 - Intro to Druid on KubernetesDok Talks #124 - Intro to Druid on Kubernetes
Dok Talks #124 - Intro to Druid on Kubernetes
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Dsdt meetup 2017 11-21
Dsdt meetup 2017 11-21Dsdt meetup 2017 11-21
Dsdt meetup 2017 11-21
 
DSDT Meetup Nov 2017
DSDT Meetup Nov 2017DSDT Meetup Nov 2017
DSDT Meetup Nov 2017
 
Speed up R with parallel programming in the Cloud
Speed up R with parallel programming in the CloudSpeed up R with parallel programming in the Cloud
Speed up R with parallel programming in the Cloud
 
Performance and Scale: Billions of request per day (DDD2019)
Performance and Scale: Billions of request per day (DDD2019)Performance and Scale: Billions of request per day (DDD2019)
Performance and Scale: Billions of request per day (DDD2019)
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
 
XPDS13: Xen and XenServer Storage Performance - Felipe Franciosi, Citrix
XPDS13: Xen and XenServer Storage Performance - Felipe Franciosi, CitrixXPDS13: Xen and XenServer Storage Performance - Felipe Franciosi, Citrix
XPDS13: Xen and XenServer Storage Performance - Felipe Franciosi, Citrix
 
Splitgraph: AHL talk
Splitgraph: AHL talkSplitgraph: AHL talk
Splitgraph: AHL talk
 
E2E PVS Technical Overview Stephane Thirion
E2E PVS Technical Overview Stephane ThirionE2E PVS Technical Overview Stephane Thirion
E2E PVS Technical Overview Stephane Thirion
 

KĂźrzlich hochgeladen

WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 

KĂźrzlich hochgeladen (20)

WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 

Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)

  • 1. Architecting with Queues for Scale, Speed and Separation Sandy Smith DCPHP 3/11/15
  • 2. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 The Challenge 2
  • 3. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Social Contest •Show off Azure + PHP •People submit tweets to enter contest •Pull specied keywords from Twitter queue (preltered by Node.js app) •Human admins lter out inappropriate content •Humans or computer pulls out winner from approved entries, on timer or arbitrarily •Display latest entries and latest winners to public 3
  • 4. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Stretch goals •Allow any size contest •Assume global contest with distributed moderators 4
  • 5. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Initial design 5
  • 6. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 The real bottleneck What’s the slowest and most variable part of any application? 6
  • 7. Insert Text Here Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 The real bottleneck 7
  • 8. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Quick refresher Performance vs. Scaling Vertical vs. Horizontal Scaling 8
  • 9. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Traditional database design •Group by kind •Keep metadata with object or in metadata tables •Objects (Document, Person, Account) are most important •Reinforced by TableGateway, ActiveRecord patterns, and ORM and framework module generator defaults •Works for 80% of cases 9
  • 10. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Tradeoffs of traditional design •Everything’s in one table, even when you routinely only need a subset •Typically one master writes, replicants read •Design is focused around what something is, not its state or other attribute •Requires creative solutions for horizontal scaling •Encourages (but does not require) centralizing logic for a given type of data 10
  • 11. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Worst of all… •This design really didn’t show off all the stuff in Azure 11
  • 12. (We had a week left) Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Redesign time 12
  • 13. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Redesign goals •Include as much Azure stuff as is reasonable •Implement the stretch goals of scalability 13
  • 14. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Queues to the rescue! (Plus some other cool stuff) 14
  • 15. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 New approach •Keep long term but fast storage •Central concern is not the Thing (Entry) but Status – Unapproved – Approved – Denied – Winner •Separate updates to long term storage from status changes •Minimal impact to working code 15
  • 16. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Azure queuing options Azure Queues (duh) •Simple •“Short”-lived (<7 days) •Used within Azure •Uses REST •Can track message processing 16 Azure Service Bus •Enterprisey •Long-lived •In Azure or private cloud •Can use AMQP, REST, or API •Can publish/subscribe •Can batch requests •Can guarantee FIFO •etc. See https://msdn.microsoft.com/en-us/library/azure/hh767287.aspx
  • 17. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 More options •Anything you can install on Linux or Windows (RabbitMQ, ZeroMQ, Kafka, Kestrel, ActiveMQ, etc.) •Any relational or NoSQL database •Azure Tables - Simple REST NoSQL store with a twist 17
  • 18. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Solutions •Long term storage and display retrieval: Azure Table •Since entries could begin long before a conference, use Service Bus to store changes in status •Have daemons pull incoming status changes out and write them to the Table 18
  • 19. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 New design 19
  • 20. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Azure Table basics 20 require_once 'vendorautoload.php';
 use WindowsAzureCommonServicesBuilder;
 use WindowsAzureCommonServiceException;
 use WindowsAzureTableModelsEntity;
 use WindowsAzureTableModelsEdmType;
 
 // Create table REST proxy.
 $tableRestProxy = ServicesBuilder::getInstance()->createTableService($connectionString);
 
 try {
 // Create table.
 $tableRestProxy->createTable("mytable");
 } catch(ServiceException $e){
 // Handle exception based on error codes and messages.
 }
 
 $entity = new Entity();
 $entity->setPartitionKey("pk");
 $entity->setRowKey("1");
 $entity->addProperty("PropertyName", EdmType::STRING, "Sample");
 
 try {
 $tableRestProxy->insertEntity("mytable", $entity);
 } catch(ServiceException $e){
 // Handle exception based on error codes and messages.
 }
  • 21. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Create and send with Service Bus 21 require_once 'vendorautoload.php';
 use WindowsAzureServiceBusModelsQueueInfo;
 use WindowsAzureCommonServiceException;
 use WindowsAzureCommonServicesBuilder;
 
 $serviceBusRestProxy = ServicesBuilder::getInstance()- >createServiceBusService($connectionString);
 
 try {
 $queueInfo = new QueueInfo("myqueue");
 $serviceBusRestProxy->createQueue($queueInfo);
 } catch(ServiceException $e) {
 // handle error
 }
 
 try {
 // Create message.
 $message = new BrokeredMessage();
 $message->setBody("my message");
 
 // Send message.
 $serviceBusRestProxy->sendQueueMessage("myqueue", $message);
 } catch(ServiceException $e) {
 // handle error
 }
  • 22. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Receive with Service Bus 22 require_once 'vendorautoload.php';
 use WindowsAzureServiceBusModelsQueueInfo;
 use WindowsAzureCommonServiceException;
 use WindowsAzureCommonServicesBuilder;
 
 $serviceBusRestProxy = ServicesBuilder::getInstance()- >createServiceBusService($connectionString);
 
 try {
 // Set the receive mode to PeekLock (default is ReceiveAndDelete).
 $options = new ReceiveMessageOptions();
 $options->setPeekLock(true);
 
 // Receive message.
 $message = $serviceBusRestProxy->receiveQueueMessage("myqueue", $options);
 echo "Body: ".$message->getBody()."<br />";
 echo "MessageID: ".$message->getMessageId()."<br />";
 
 // *** Process message here ***
 
 // Delete message.
 $serviceBusRestProxy->deleteMessage($message);
 } catch(ServiceException $e){
 // handle error
 }
  • 23. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Benefits •Queues add safety: if processing fails, main store is unchanged •App doesn’t wait for process-update-delete cycle – Concerns more separated •Can move queue processing to separate machines •Trivial to move to different stores for each status •Very performant with up-to-second data 23
  • 24. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Challenges •No full ACID •Safety is largely in the application layer •Potential for race conditions – Humans suck 24
  • 25. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Takeaways •Look for more than just long processes •Use to decouple functions •Look for status changes •Is the type of data the most important aspect of your data? – It usually is! •Design for replacement of components – Makes changes easier (not easy) 25
  • 26. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Links •Azure: http://azure.microsoft.com/en-us/ •Social Contest:
 https://github.com/MusketeersMe/SocialContest •Me – @SandyS1 – http://phparch.com/ •Feedback! https://joind.in/event/dc-php-march-2015 •Lone Star PHP (April 16–18): http://lonestarphp.com •php[tek] (May 18–22) http://tek.phparch.com •Slides will be at: http://www.slideshare.net/SandySmith 26
  • 27. Architecting with Queues - Sandy Smith - DCPHP - 3/11/15 Image credits •Questions? by Valerie Everett
 https://flic.kr/p/5zEjFG •Expanded coke zero can! by Audin Malmin
 https://flic.kr/p/5Ldjx8 27