SlideShare a Scribd company logo
1 of 30
Download to read offline
Architecting with Queues for
Scale and Separation
Sandy Smith
Northeast PHP 2015
Insert Text Here
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Setting Expectations
2
Architecting with Queues - Sandy Smith - Northeast PHP 2015
What this talk is NOT
•A queues HOWTO (though there is some)
•Benchmark bonanza
•An Azure talk (though there is some)
3
Architecting with Queues - Sandy Smith - Northeast PHP 2015
What this talk IS
•An architecture talk
•A challenge to think differently about your applications
•A story about rapidly developing an app
4
Architecting with Queues - Sandy Smith - Northeast PHP 2015
The Challenge
5
Architecting with Queues - Sandy Smith - Northeast PHP 2015
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
6
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Stretch goals
•Allow any size contest
•Assume global contest with distributed moderators
7
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Quick refresher
Performance vs. Scaling

Vertical vs. Horizontal Scaling
8
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Initial design
9
Architecting with Queues - Sandy Smith - Northeast PHP 2015
System-level view
10
Twitter
Firehose
Entries
node.js app
Contest App DB
Public
Admins
Architecting with Queues - Sandy Smith - Northeast PHP 2015
The real bottleneck
What’s the slowest and
most variable part of any
application?
11
Insert Text Here
Architecting with Queues - Sandy Smith - Northeast PHP 2015
The real bottleneck
12
Architecting with Queues - Sandy Smith - Northeast PHP 2015
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
13
Architecting with Queues - Sandy Smith - Northeast PHP 2015
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
14
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Worst of all…
•This design really didn’t show off all the stuff in Azure
15
(We had a week left)
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Redesign time
16
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Redesign goals
•Include as much Azure stuff as is reasonable
•Implement the stretch goals of scalability
17
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Queues to the rescue!
(Plus some other cool stuff)
18
Architecting with Queues - Sandy Smith - Northeast PHP 2015
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
19
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Azure queuing options
Azure Queues (duh)
•Simple
•“Short”-lived (<7 days)
•Used within Azure
•Uses REST
•Can track message
processing
20
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 - Northeast PHP 2015
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
21
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Solutions
•Long term storage and display retrieval: Azure Table
•Since Node.js app already used it, use Service Bus to store
changes in status for consistency
•Have daemons pull incoming status changes out and write
them to the Table
22
Architecting with Queues - Sandy Smith - Northeast PHP 2015
New design
23
__construct(EntryAccessor $mapper)
Entry
EntryAccessor
__construct($proxy, $table)
EntryAccessorTable
EntryRepository
__construct($dbh)
EntryRepositoryTable
Entries
Incoming
Daemon
Denied
Winner
Approv-
ed
In-
coming
Approved
Daemon
Denied
Daemon
Winner
Daemon
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Azure Table basics
24
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 - Northeast PHP 2015
Create and send with Service Bus
25
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 - Northeast PHP 2015
Receive with Service Bus
26
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 - Northeast PHP 2015
Benefits
•Queues add safety: if processing fails, main store is unchanged
•App doesn’t wait for process-update-delete cycle
– Concerns more separated

– Scaling is simpler

•Can move queue processing to separate machines
•Trivial to move to different stores for each status
•Very performant with up-to-second data
27
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Challenges
•No full ACID
•Safety is largely in the application layer
•Potential for race conditions
– Humans suck
28
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Takeaways
•Look for more than just long processes
•Use queues to decouple functionality
•Look for status changes, e.g. workflow
•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)
29
Architecting with Queues - Sandy Smith - Northeast PHP 2015
Links
•Azure: http://azure.microsoft.com/en-us/
•Social Contest:

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

– http://phparch.com/

•Feedback! https://joind.in/14720
•php[world] (Nov 16–20) world.phparch.com
•Slides will be at: slideshare.net/SandySmith
30

More Related Content

What's hot

Node.js and couchbase Full Stack JSON - Munich NoSQL
Node.js and couchbase   Full Stack JSON - Munich NoSQLNode.js and couchbase   Full Stack JSON - Munich NoSQL
Node.js and couchbase Full Stack JSON - Munich NoSQLPhilipp Fehre
 
OSCON2014: Understanding Hypervisor Selection in Apache CloudStack
OSCON2014: Understanding Hypervisor Selection in Apache CloudStackOSCON2014: Understanding Hypervisor Selection in Apache CloudStack
OSCON2014: Understanding Hypervisor Selection in Apache CloudStackTim Mackey
 
MySQL Monitoring with Zabbix
MySQL Monitoring with ZabbixMySQL Monitoring with Zabbix
MySQL Monitoring with ZabbixFromDual GmbH
 
Scaling wix to over 70 m users
Scaling wix to over 70 m usersScaling wix to over 70 m users
Scaling wix to over 70 m usersYoav Avrahami
 
CFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful CodeCFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful Codeindiver
 
Redis Labs and SQL Server
Redis Labs and SQL ServerRedis Labs and SQL Server
Redis Labs and SQL ServerLynn Langit
 
Drupal High Availability High Performance 2012
Drupal High Availability High Performance 2012Drupal High Availability High Performance 2012
Drupal High Availability High Performance 2012Amazee Labs
 
Роман Новиков "Best Practices for MySQL Performance & Troubleshooting with th...
Роман Новиков "Best Practices for MySQL Performance & Troubleshooting with th...Роман Новиков "Best Practices for MySQL Performance & Troubleshooting with th...
Роман Новиков "Best Practices for MySQL Performance & Troubleshooting with th...Fwdays
 
Data stores: beyond relational databases
Data stores: beyond relational databasesData stores: beyond relational databases
Data stores: beyond relational databasesJavier García Magna
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningSeveralnines
 
4th Lecture: JSP and such
4th Lecture:  JSP and such4th Lecture:  JSP and such
4th Lecture: JSP and suchManolis Vavalis
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelAlex Thissen
 
Nagios Conference 2014 - Luis Contreras - Monitoring SAP System with Nagios Core
Nagios Conference 2014 - Luis Contreras - Monitoring SAP System with Nagios CoreNagios Conference 2014 - Luis Contreras - Monitoring SAP System with Nagios Core
Nagios Conference 2014 - Luis Contreras - Monitoring SAP System with Nagios CoreNagios
 
Essential Camel Components
Essential Camel ComponentsEssential Camel Components
Essential Camel ComponentsChristian Posta
 
Planning a successful private cloud - CloudStack Collaboration Europe 2013
Planning a successful private cloud - CloudStack Collaboration Europe 2013Planning a successful private cloud - CloudStack Collaboration Europe 2013
Planning a successful private cloud - CloudStack Collaboration Europe 2013Tim Mackey
 
Building a Dev/Test Cloud with Apache CloudStack
Building a Dev/Test Cloud with Apache CloudStackBuilding a Dev/Test Cloud with Apache CloudStack
Building a Dev/Test Cloud with Apache CloudStackke4qqq
 
ASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonPhil Pursglove
 
Lessons from the Trenches - Building Enterprise Applications with RavenDB
Lessons from the Trenches - Building Enterprise Applications with RavenDBLessons from the Trenches - Building Enterprise Applications with RavenDB
Lessons from the Trenches - Building Enterprise Applications with RavenDBOren Eini
 
Membase Intro from Membase Meetup San Francisco
Membase Intro from Membase Meetup San FranciscoMembase Intro from Membase Meetup San Francisco
Membase Intro from Membase Meetup San FranciscoMembase
 

What's hot (20)

Serverless Go at BuzzBird
Serverless Go at BuzzBirdServerless Go at BuzzBird
Serverless Go at BuzzBird
 
Node.js and couchbase Full Stack JSON - Munich NoSQL
Node.js and couchbase   Full Stack JSON - Munich NoSQLNode.js and couchbase   Full Stack JSON - Munich NoSQL
Node.js and couchbase Full Stack JSON - Munich NoSQL
 
OSCON2014: Understanding Hypervisor Selection in Apache CloudStack
OSCON2014: Understanding Hypervisor Selection in Apache CloudStackOSCON2014: Understanding Hypervisor Selection in Apache CloudStack
OSCON2014: Understanding Hypervisor Selection in Apache CloudStack
 
MySQL Monitoring with Zabbix
MySQL Monitoring with ZabbixMySQL Monitoring with Zabbix
MySQL Monitoring with Zabbix
 
Scaling wix to over 70 m users
Scaling wix to over 70 m usersScaling wix to over 70 m users
Scaling wix to over 70 m users
 
CFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful CodeCFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful Code
 
Redis Labs and SQL Server
Redis Labs and SQL ServerRedis Labs and SQL Server
Redis Labs and SQL Server
 
Drupal High Availability High Performance 2012
Drupal High Availability High Performance 2012Drupal High Availability High Performance 2012
Drupal High Availability High Performance 2012
 
Роман Новиков "Best Practices for MySQL Performance & Troubleshooting with th...
Роман Новиков "Best Practices for MySQL Performance & Troubleshooting with th...Роман Новиков "Best Practices for MySQL Performance & Troubleshooting with th...
Роман Новиков "Best Practices for MySQL Performance & Troubleshooting with th...
 
Data stores: beyond relational databases
Data stores: beyond relational databasesData stores: beyond relational databases
Data stores: beyond relational databases
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
 
4th Lecture: JSP and such
4th Lecture:  JSP and such4th Lecture:  JSP and such
4th Lecture: JSP and such
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
 
Nagios Conference 2014 - Luis Contreras - Monitoring SAP System with Nagios Core
Nagios Conference 2014 - Luis Contreras - Monitoring SAP System with Nagios CoreNagios Conference 2014 - Luis Contreras - Monitoring SAP System with Nagios Core
Nagios Conference 2014 - Luis Contreras - Monitoring SAP System with Nagios Core
 
Essential Camel Components
Essential Camel ComponentsEssential Camel Components
Essential Camel Components
 
Planning a successful private cloud - CloudStack Collaboration Europe 2013
Planning a successful private cloud - CloudStack Collaboration Europe 2013Planning a successful private cloud - CloudStack Collaboration Europe 2013
Planning a successful private cloud - CloudStack Collaboration Europe 2013
 
Building a Dev/Test Cloud with Apache CloudStack
Building a Dev/Test Cloud with Apache CloudStackBuilding a Dev/Test Cloud with Apache CloudStack
Building a Dev/Test Cloud with Apache CloudStack
 
ASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG London
 
Lessons from the Trenches - Building Enterprise Applications with RavenDB
Lessons from the Trenches - Building Enterprise Applications with RavenDBLessons from the Trenches - Building Enterprise Applications with RavenDB
Lessons from the Trenches - Building Enterprise Applications with RavenDB
 
Membase Intro from Membase Meetup San Francisco
Membase Intro from Membase Meetup San FranciscoMembase Intro from Membase Meetup San Francisco
Membase Intro from Membase Meetup San Francisco
 

Viewers also liked

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
 
Out of the silos and into the farm (NEPHP 2014)
Out of the silos and into the farm (NEPHP 2014)Out of the silos and into the farm (NEPHP 2014)
Out of the silos and into the farm (NEPHP 2014)Marli Mesibov
 
Unit Testing Done Right
Unit Testing Done RightUnit Testing Done Right
Unit Testing Done RightBrian Fenton
 
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
 
Multibyte string handling in PHP
Multibyte string handling in PHPMultibyte string handling in PHP
Multibyte string handling in PHPDaniel_Rhodes
 
Unicode Regular Expressions
Unicode Regular ExpressionsUnicode Regular Expressions
Unicode Regular ExpressionsNova Patch
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsdavidfstr
 
Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Sandy Smith
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsNicole Ryan
 
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
 
Lessons from a Dying CMS
Lessons from a Dying CMSLessons from a Dying CMS
Lessons from a Dying CMSSandy Smith
 
GAIQ - Regular expressions-google-analytics
GAIQ - Regular expressions-google-analyticsGAIQ - Regular expressions-google-analytics
GAIQ - Regular expressions-google-analyticsAnkita Kishore
 
Hyperlocalisation or "localising everything"
Hyperlocalisation or "localising everything"Hyperlocalisation or "localising everything"
Hyperlocalisation or "localising everything"Daniel_Rhodes
 
Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)
Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)
Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)Sandy Smith
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsJames Gray
 
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
 
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
 

Viewers also liked (20)

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
 
Out of the silos and into the farm (NEPHP 2014)
Out of the silos and into the farm (NEPHP 2014)Out of the silos and into the farm (NEPHP 2014)
Out of the silos and into the farm (NEPHP 2014)
 
Unit Testing Done Right
Unit Testing Done RightUnit Testing Done Right
Unit Testing Done Right
 
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
 
Multibyte string handling in PHP
Multibyte string handling in PHPMultibyte string handling in PHP
Multibyte string handling in PHP
 
Unicode Regular Expressions
Unicode Regular ExpressionsUnicode Regular Expressions
Unicode Regular Expressions
 
Grokking regex
Grokking regexGrokking regex
Grokking regex
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
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
 
Lessons from a Dying CMS
Lessons from a Dying CMSLessons from a Dying CMS
Lessons from a Dying CMS
 
GAIQ - Regular expressions-google-analytics
GAIQ - Regular expressions-google-analyticsGAIQ - Regular expressions-google-analytics
GAIQ - Regular expressions-google-analytics
 
Intoduction to php strings
Intoduction to php  stringsIntoduction to php  strings
Intoduction to php strings
 
Hyperlocalisation or "localising everything"
Hyperlocalisation or "localising everything"Hyperlocalisation or "localising everything"
Hyperlocalisation or "localising everything"
 
Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)
Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)
Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)
 
Dom
DomDom
Dom
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
TDA Center Depok update 2014 (Concept)
TDA Center Depok update 2014 (Concept)TDA Center Depok update 2014 (Concept)
TDA Center Depok update 2014 (Concept)
 
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)?
 

Similar to Architecting with Queues - Northeast PHP 2015

WinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf
 
OpenIDM - Flexible Provisioning Platform - April 28 Webinar
OpenIDM - Flexible Provisioning Platform - April 28 WebinarOpenIDM - Flexible Provisioning Platform - April 28 Webinar
OpenIDM - Flexible Provisioning Platform - April 28 WebinarForgeRock
 
Challenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopChallenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopDataWorks Summit
 
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
 
Data(?)Ops with CircleCI
Data(?)Ops with CircleCIData(?)Ops with CircleCI
Data(?)Ops with CircleCIJinwoong Kim
 
Deep Dive - Usage of on premises data gateway for hybrid integration scenarios
Deep Dive - Usage of on premises data gateway for hybrid integration scenariosDeep Dive - Usage of on premises data gateway for hybrid integration scenarios
Deep Dive - Usage of on premises data gateway for hybrid integration scenariosSajith C P Nair
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpChalermpon Areepong
 
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...Emerson Eduardo Rodrigues Von Staffen
 
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...Amazon Web Services
 
Bye bye $GLOBALS['TYPO3_DB']
Bye bye $GLOBALS['TYPO3_DB']Bye bye $GLOBALS['TYPO3_DB']
Bye bye $GLOBALS['TYPO3_DB']Jan Helke
 
PPWT2019 - EmPower your BI architecture
PPWT2019 - EmPower your BI architecturePPWT2019 - EmPower your BI architecture
PPWT2019 - EmPower your BI architectureRiccardo Perico
 
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...DataKitchen
 
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
 
Azure + DataStax Enterprise Powers Office 365 Per User Store
Azure + DataStax Enterprise Powers Office 365 Per User StoreAzure + DataStax Enterprise Powers Office 365 Per User Store
Azure + DataStax Enterprise Powers Office 365 Per User StoreDataStax Academy
 
Using Databases and Containers From Development to Deployment
Using Databases and Containers  From Development to DeploymentUsing Databases and Containers  From Development to Deployment
Using Databases and Containers From Development to DeploymentAerospike, Inc.
 
SQL Engines for Hadoop - The case for Impala
SQL Engines for Hadoop - The case for ImpalaSQL Engines for Hadoop - The case for Impala
SQL Engines for Hadoop - The case for Impalamarkgrover
 

Similar to Architecting with Queues - Northeast PHP 2015 (20)

WinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release Pipelines
 
OpenIDM - Flexible Provisioning Platform - April 28 Webinar
OpenIDM - Flexible Provisioning Platform - April 28 WebinarOpenIDM - Flexible Provisioning Platform - April 28 Webinar
OpenIDM - Flexible Provisioning Platform - April 28 Webinar
 
Challenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopChallenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on Hadoop
 
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
 
Data(?)Ops with CircleCI
Data(?)Ops with CircleCIData(?)Ops with CircleCI
Data(?)Ops with CircleCI
 
Deep Dive - Usage of on premises data gateway for hybrid integration scenarios
Deep Dive - Usage of on premises data gateway for hybrid integration scenariosDeep Dive - Usage of on premises data gateway for hybrid integration scenarios
Deep Dive - Usage of on premises data gateway for hybrid integration scenarios
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
 
Windows Azure Essentials V3
Windows Azure Essentials V3Windows Azure Essentials V3
Windows Azure Essentials V3
 
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
 
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
 
Ipc mysql php
Ipc mysql php Ipc mysql php
Ipc mysql php
 
Bye bye $GLOBALS['TYPO3_DB']
Bye bye $GLOBALS['TYPO3_DB']Bye bye $GLOBALS['TYPO3_DB']
Bye bye $GLOBALS['TYPO3_DB']
 
PPWT2019 - EmPower your BI architecture
PPWT2019 - EmPower your BI architecturePPWT2019 - EmPower your BI architecture
PPWT2019 - EmPower your BI architecture
 
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
 
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
 
SD Times - Docker v2
SD Times - Docker v2SD Times - Docker v2
SD Times - Docker v2
 
Azure + DataStax Enterprise Powers Office 365 Per User Store
Azure + DataStax Enterprise Powers Office 365 Per User StoreAzure + DataStax Enterprise Powers Office 365 Per User Store
Azure + DataStax Enterprise Powers Office 365 Per User Store
 
Using Databases and Containers From Development to Deployment
Using Databases and Containers  From Development to DeploymentUsing Databases and Containers  From Development to Deployment
Using Databases and Containers From Development to Deployment
 
SQL Engines for Hadoop - The case for Impala
SQL Engines for Hadoop - The case for ImpalaSQL Engines for Hadoop - The case for Impala
SQL Engines for Hadoop - The case for Impala
 

Recently uploaded

Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 

Recently uploaded (20)

Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 

Architecting with Queues - Northeast PHP 2015

  • 1. Architecting with Queues for Scale and Separation Sandy Smith Northeast PHP 2015
  • 2. Insert Text Here Architecting with Queues - Sandy Smith - Northeast PHP 2015 Setting Expectations 2
  • 3. Architecting with Queues - Sandy Smith - Northeast PHP 2015 What this talk is NOT •A queues HOWTO (though there is some) •Benchmark bonanza •An Azure talk (though there is some) 3
  • 4. Architecting with Queues - Sandy Smith - Northeast PHP 2015 What this talk IS •An architecture talk •A challenge to think differently about your applications •A story about rapidly developing an app 4
  • 5. Architecting with Queues - Sandy Smith - Northeast PHP 2015 The Challenge 5
  • 6. Architecting with Queues - Sandy Smith - Northeast PHP 2015 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 6
  • 7. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Stretch goals •Allow any size contest •Assume global contest with distributed moderators 7
  • 8. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Quick refresher Performance vs. Scaling Vertical vs. Horizontal Scaling 8
  • 9. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Initial design 9
  • 10. Architecting with Queues - Sandy Smith - Northeast PHP 2015 System-level view 10 Twitter Firehose Entries node.js app Contest App DB Public Admins
  • 11. Architecting with Queues - Sandy Smith - Northeast PHP 2015 The real bottleneck What’s the slowest and most variable part of any application? 11
  • 12. Insert Text Here Architecting with Queues - Sandy Smith - Northeast PHP 2015 The real bottleneck 12
  • 13. Architecting with Queues - Sandy Smith - Northeast PHP 2015 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 13
  • 14. Architecting with Queues - Sandy Smith - Northeast PHP 2015 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 14
  • 15. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Worst of all… •This design really didn’t show off all the stuff in Azure 15
  • 16. (We had a week left) Architecting with Queues - Sandy Smith - Northeast PHP 2015 Redesign time 16
  • 17. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Redesign goals •Include as much Azure stuff as is reasonable •Implement the stretch goals of scalability 17
  • 18. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Queues to the rescue! (Plus some other cool stuff) 18
  • 19. Architecting with Queues - Sandy Smith - Northeast PHP 2015 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 19
  • 20. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Azure queuing options Azure Queues (duh) •Simple •“Short”-lived (<7 days) •Used within Azure •Uses REST •Can track message processing 20 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
  • 21. Architecting with Queues - Sandy Smith - Northeast PHP 2015 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 21
  • 22. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Solutions •Long term storage and display retrieval: Azure Table •Since Node.js app already used it, use Service Bus to store changes in status for consistency •Have daemons pull incoming status changes out and write them to the Table 22
  • 23. Architecting with Queues - Sandy Smith - Northeast PHP 2015 New design 23 __construct(EntryAccessor $mapper) Entry EntryAccessor __construct($proxy, $table) EntryAccessorTable EntryRepository __construct($dbh) EntryRepositoryTable Entries Incoming Daemon Denied Winner Approv- ed In- coming Approved Daemon Denied Daemon Winner Daemon
  • 24. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Azure Table basics 24 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.
 }
  • 25. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Create and send with Service Bus 25 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
 }
  • 26. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Receive with Service Bus 26 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
 }
  • 27. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Benefits •Queues add safety: if processing fails, main store is unchanged •App doesn’t wait for process-update-delete cycle – Concerns more separated – Scaling is simpler •Can move queue processing to separate machines •Trivial to move to different stores for each status •Very performant with up-to-second data 27
  • 28. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Challenges •No full ACID •Safety is largely in the application layer •Potential for race conditions – Humans suck 28
  • 29. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Takeaways •Look for more than just long processes •Use queues to decouple functionality •Look for status changes, e.g. workflow •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) 29
  • 30. Architecting with Queues - Sandy Smith - Northeast PHP 2015 Links •Azure: http://azure.microsoft.com/en-us/ •Social Contest:
 https://github.com/MusketeersMe/SocialContest •Me – @SandyS1 – http://phparch.com/ •Feedback! https://joind.in/14720 •php[world] (Nov 16–20) world.phparch.com •Slides will be at: slideshare.net/SandySmith 30