SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Queuing at the Checkout
Bulgaria Web Summit 2015
★Chief Technical Architect at Reward Gateway
★Interested in scalability and engineering
★“PHP addict!”
Who am I?
<html>	
  
	
  	
  <head>	
  
	
  	
  	
  	
  <title>Tutorial</title>	
  
	
  	
  </head>	
  
	
  	
  <body>	
  
	
  	
  	
  	
  <?php	
  echo	
  "<p>Hello	
  World</p>";	
  ?>	
  
	
  	
  </body>	
  
</html>	
  
“Do not wait; the time will never be
'just right.' Start where you stand,
and work with whatever tools you
may have at your command, and
better tools will be found as you go
along.”
American author, Napoleon Hill
(1883-1970)
A modern web application
Modern applications are complex
★Modern web
applications often do
not work in isolation.
★Gone are the days of a
single database
powering everything.
★Integrate with
Facebook, Stripe, etc.
Your application
Facebook
Stripe
Amazon S3Zendesk
Adding an API
★Let’s add a new SOAP
service to our
application.
<?xml	
  version="1.0"?>	
  
<soap:Envelope	
  
xmlns:soap="http://www.w3.org/2001/12/soap-­‐envelope"	
  
soap:encodingStyle="http://www.w3.org/2001/12/soap-­‐encoding">	
  
<soap:Body>	
  
	
  	
  <m:GetName	
  xmlns:m="http://www.example.com/name">	
  
	
  	
  	
  	
  <m:Item>John</m:Item>	
  
	
  	
  </m:GetPrice>	
  
</soap:Body>	
  
</soap:Envelope>	
  
Adding an API
★Let’s add a new SOAP
service to our
application.
★PHP makes this really
easy!<?php	
  
$client	
  =	
  new	
  SoapClient("http://www.example.com/some.wsdl");	
  
echo	
  "Hi	
  "	
  .	
  $client-­‐>name()	
  .	
  "n";	
  
Adding an API
★Let’s add a new SOAP
service to our
application.
★PHP makes this really
easy!
★We can be in
production in two
minutes.
$	
  php	
  client.php	
  
Hi	
  John	
  
$	
  php	
  client.php	
  
Hi	
  Dave	
  
$	
  php	
  client.php	
  
Hi	
  Colin	
  
Maintenance
Performance
Scaling
Poor response times lead to loss of revenue
★The slower your site,
the more likely people
are to give up (“exit”)
★Over 75% of people in
an Akami survey said
they would stop using
a site if it took longer
than 4 seconds.
★The more people who
give up, the less
money you’ll make.
ExitRate
0%
5%
10%
15%
20%
Load Time (secs)
0
.1
1
2
3
What can you do?
TL;DR
★Split your application into bits.
★Keep the predictable bit on the request path.
★Move the unpredictable bit somewhere else.
★Use a message queue to communicate between the two halves.
Message Queue Servers
★There are lots of message queue implementations:
★ RabbitMQ
★ Amazon SQS
★ OpenAMQ
★ ….
★Written in different languages with different tradeoffs.
★Almost all support a protocol called AMQP.
Message Queue Basics
★AMQP has three
concepts.
★Exchanges route
messages using rules
★Queues are where
messages wait for
processing
★Bindings define the
routing rules
Publisher
Publisher
Exchange
Exchange
Queue
Queue
Consumer
Consumer
Consumer
Exchange Rules
★The exchanges
understand three
types of rule:
★ Fanout
★ Direct
★ Topic
★You can create almost
any structure with this
set.
Publisher Exchange Queue Consumer
Consumer
Fanout
Queue
Publisher Exchange Queue Consumer
Direct
Exchange Rules Continued
★The exchanges
understand three
types of rule:
★ Fanout
★ Direct
★ Topic
★You can create almost
any structure with this
set.
Publisher Exchange
Queue Consumer
Consumer
Topic
Queue
lazy.#
*.orange.*
*.*.rabbit
Basic Publisher
<?php	
  
require_once	
  __DIR__	
  .	
  '/vendor/autoload.php';	
  
use	
  PhpAmqpLibConnectionAMQPConnection;	
  
use	
  PhpAmqpLibMessageAMQPMessage;	
  
$connection	
  =	
  new	
  AMQPConnection('localhost',	
  5672,	
  'guest',	
  ‘guest');	
  
$channel	
  =	
  $connection-­‐>channel();	
  
$channel-­‐>queue_declare('hello',	
  false,	
  false,	
  false,	
  false);	
  
$msg	
  =	
  new	
  AMQPMessage('Hello	
  World!');	
  
$channel-­‐>basic_publish($msg,	
  '',	
  'hello');	
  
echo	
  "	
  [x]	
  Sent	
  'Hello	
  World!’n”;	
  
$channel-­‐>close();	
  
$connection-­‐>close();	
  
Basic Consumer
#!/usr/bin/env	
  python	
  
import	
  pika	
  
connection	
  =	
  pika.BlockingConnection(pika.ConnectionParameters(	
  
	
  	
  	
  	
  	
  	
  	
  	
  host='localhost'))	
  
channel	
  =	
  connection.channel()	
  
channel.queue_declare(queue='hello')	
  
print	
  '	
  [*]	
  Waiting	
  for	
  messages.	
  To	
  exit	
  press	
  CTRL+C'	
  
def	
  callback(ch,	
  method,	
  properties,	
  body):	
  
	
  	
  	
  	
  print	
  "	
  [x]	
  Received	
  %r"	
  %	
  (body,)	
  
channel.basic_consume(callback,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  queue='hello',	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  no_ack=True)	
  
channel.start_consuming()
Still need to handle problems…
★You still have to
monitor your queues.
★Easy to see when
things go wrong.
★More advanced
features let you cope
with this better (e.g.
timeouts on delivery)
QueueSize(messages)
0
250
500
750
1,000
Requests (/secs)
0
10
0
20
0
30
0
Still need to handle crashes…
★What happens when the message queue server crashes?
★ You also still need to worry about your data.
★By default, nothing is saved by RabbitMQ (i.e you lose everything.)
★Pay attention to durability settings when configuring the queues.
Some helpful tools
“Bad API”
★http://badapi.trip.tv
★Allows you to send a request and get a known response back.
★Lets you specify how long to delay the response
★Lets you specify a HTTP error code
★Good for simulating a poorly performing API
“RabbitMQ Simulator”
★http://tryrabbitmq.com
★Single page simulator for RabbitMQ
★Interactive user interface
★Lets you try out all the concepts in this talk and get comfortable with exchanges,
bindings etc.
Conclusion
★Keep your application predictable - move the unpredictable bit out.
★Your integration tests should consider API failures and performance problems.
★Command-Query Response Separation can really help in this area (another talk!)
★We’re hiring! http://rg.co/careers
Questions

Weitere ähnliche Inhalte

Was ist angesagt?

Gearman, Supervisor and PHP - Job Management with Sanity!
Gearman, Supervisor and PHP - Job Management with Sanity!Gearman, Supervisor and PHP - Job Management with Sanity!
Gearman, Supervisor and PHP - Job Management with Sanity!Abu Ashraf Masnun
 
The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)danwrong
 
Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanIssac Goldstand
 
Khanh-Nguyen - Gearman - distributed process solution
Khanh-Nguyen - Gearman - distributed process solutionKhanh-Nguyen - Gearman - distributed process solution
Khanh-Nguyen - Gearman - distributed process solutionJavaScript Meetup HCMC
 
Abusing the Cloud for Fun and Profit
Abusing the Cloud for Fun and ProfitAbusing the Cloud for Fun and Profit
Abusing the Cloud for Fun and ProfitAlan Pinstein
 
The Mysteries Of JavaScript-Fu (@media Europe Edition)
The Mysteries Of JavaScript-Fu (@media Europe Edition)The Mysteries Of JavaScript-Fu (@media Europe Edition)
The Mysteries Of JavaScript-Fu (@media Europe Edition)danwrong
 
Being a pimp without silverlight
Being a pimp without silverlightBeing a pimp without silverlight
Being a pimp without silverlightMaarten Balliauw
 
Deploying Rails on EC2 using Rubber (Slides Only)
Deploying Rails on EC2 using Rubber (Slides Only)Deploying Rails on EC2 using Rubber (Slides Only)
Deploying Rails on EC2 using Rubber (Slides Only)wr0ngway
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleMike Willbanks
 
[Back2 basic] from c10k problem to concurrency concept
[Back2 basic] from c10k problem to concurrency concept[Back2 basic] from c10k problem to concurrency concept
[Back2 basic] from c10k problem to concurrency conceptTrịnh Thế Thành
 
Cloud-Native DevOps Engineering
Cloud-Native DevOps EngineeringCloud-Native DevOps Engineering
Cloud-Native DevOps EngineeringDiego Pacheco
 
Gearman and asynchronous processing in PHP applications
Gearman and asynchronous processing in PHP applicationsGearman and asynchronous processing in PHP applications
Gearman and asynchronous processing in PHP applicationsDinh Pham
 
Ops, DevOps, NoOps and AWS Lambda
Ops, DevOps, NoOps and AWS LambdaOps, DevOps, NoOps and AWS Lambda
Ops, DevOps, NoOps and AWS LambdaMatthew Boeckman
 
Spreadshirt Techcamp 2018 - Hold until Told
Spreadshirt Techcamp 2018 - Hold until ToldSpreadshirt Techcamp 2018 - Hold until Told
Spreadshirt Techcamp 2018 - Hold until ToldMartin Breest
 
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)danwrong
 

Was ist angesagt? (20)

Queue your work
Queue your workQueue your work
Queue your work
 
Build App with Nodejs - YWC Workshop
Build App with Nodejs - YWC WorkshopBuild App with Nodejs - YWC Workshop
Build App with Nodejs - YWC Workshop
 
Gearman, Supervisor and PHP - Job Management with Sanity!
Gearman, Supervisor and PHP - Job Management with Sanity!Gearman, Supervisor and PHP - Job Management with Sanity!
Gearman, Supervisor and PHP - Job Management with Sanity!
 
The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)
 
Web Assembly (W3C TPAC presentation)
Web Assembly (W3C TPAC presentation)Web Assembly (W3C TPAC presentation)
Web Assembly (W3C TPAC presentation)
 
Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & Gearman
 
Khanh-Nguyen - Gearman - distributed process solution
Khanh-Nguyen - Gearman - distributed process solutionKhanh-Nguyen - Gearman - distributed process solution
Khanh-Nguyen - Gearman - distributed process solution
 
Abusing the Cloud for Fun and Profit
Abusing the Cloud for Fun and ProfitAbusing the Cloud for Fun and Profit
Abusing the Cloud for Fun and Profit
 
The Mysteries Of JavaScript-Fu (@media Europe Edition)
The Mysteries Of JavaScript-Fu (@media Europe Edition)The Mysteries Of JavaScript-Fu (@media Europe Edition)
The Mysteries Of JavaScript-Fu (@media Europe Edition)
 
Being a pimp without silverlight
Being a pimp without silverlightBeing a pimp without silverlight
Being a pimp without silverlight
 
Deploying Rails on EC2 using Rubber (Slides Only)
Deploying Rails on EC2 using Rubber (Slides Only)Deploying Rails on EC2 using Rubber (Slides Only)
Deploying Rails on EC2 using Rubber (Slides Only)
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for Scale
 
[Back2 basic] from c10k problem to concurrency concept
[Back2 basic] from c10k problem to concurrency concept[Back2 basic] from c10k problem to concurrency concept
[Back2 basic] from c10k problem to concurrency concept
 
Observables - the why, what & how
Observables - the why, what & howObservables - the why, what & how
Observables - the why, what & how
 
Gearman and Perl
Gearman and PerlGearman and Perl
Gearman and Perl
 
Cloud-Native DevOps Engineering
Cloud-Native DevOps EngineeringCloud-Native DevOps Engineering
Cloud-Native DevOps Engineering
 
Gearman and asynchronous processing in PHP applications
Gearman and asynchronous processing in PHP applicationsGearman and asynchronous processing in PHP applications
Gearman and asynchronous processing in PHP applications
 
Ops, DevOps, NoOps and AWS Lambda
Ops, DevOps, NoOps and AWS LambdaOps, DevOps, NoOps and AWS Lambda
Ops, DevOps, NoOps and AWS Lambda
 
Spreadshirt Techcamp 2018 - Hold until Told
Spreadshirt Techcamp 2018 - Hold until ToldSpreadshirt Techcamp 2018 - Hold until Told
Spreadshirt Techcamp 2018 - Hold until Told
 
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
 

Andere mochten auch

Information security diligence issue 4.5
Information security diligence issue 4.5 Information security diligence issue 4.5
Information security diligence issue 4.5 Reward Gateway
 
Information for new clients.
Information for new clients.Information for new clients.
Information for new clients.Reward Gateway
 
CEO Glenn Elliott's User Manual : A solution for poor employee trust?
CEO Glenn Elliott's User Manual : A solution for poor employee trust?CEO Glenn Elliott's User Manual : A solution for poor employee trust?
CEO Glenn Elliott's User Manual : A solution for poor employee trust?Reward Gateway
 
Review: Wellness technology in the workplace
Review: Wellness technology in the workplace Review: Wellness technology in the workplace
Review: Wellness technology in the workplace Reward Gateway
 
Total Rewards Strategy- Debra Corey
Total Rewards Strategy- Debra CoreyTotal Rewards Strategy- Debra Corey
Total Rewards Strategy- Debra CoreyExpedite HR
 
Bridging the employee engagement gap
Bridging the employee engagement gapBridging the employee engagement gap
Bridging the employee engagement gapReward Gateway
 

Andere mochten auch (6)

Information security diligence issue 4.5
Information security diligence issue 4.5 Information security diligence issue 4.5
Information security diligence issue 4.5
 
Information for new clients.
Information for new clients.Information for new clients.
Information for new clients.
 
CEO Glenn Elliott's User Manual : A solution for poor employee trust?
CEO Glenn Elliott's User Manual : A solution for poor employee trust?CEO Glenn Elliott's User Manual : A solution for poor employee trust?
CEO Glenn Elliott's User Manual : A solution for poor employee trust?
 
Review: Wellness technology in the workplace
Review: Wellness technology in the workplace Review: Wellness technology in the workplace
Review: Wellness technology in the workplace
 
Total Rewards Strategy- Debra Corey
Total Rewards Strategy- Debra CoreyTotal Rewards Strategy- Debra Corey
Total Rewards Strategy- Debra Corey
 
Bridging the employee engagement gap
Bridging the employee engagement gapBridging the employee engagement gap
Bridging the employee engagement gap
 

Ähnlich wie Queueing at the Checkout

Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...nine
 
Planning to Fail #phpne13
Planning to Fail #phpne13Planning to Fail #phpne13
Planning to Fail #phpne13Dave Gardner
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous ApplicationsJohan Edstrom
 
Mazda siv - web services
Mazda   siv - web servicesMazda   siv - web services
Mazda siv - web servicesOlivier Lépine
 
Planning to Fail #phpuk13
Planning to Fail #phpuk13Planning to Fail #phpuk13
Planning to Fail #phpuk13Dave Gardner
 
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNAFirst Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNATomas Cervenka
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Peter Gfader
 
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...Amazon Web Services
 
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over WebsocketIntroduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocketsametmax
 
AWS re:Invent 2016 Fast Forward
AWS re:Invent 2016 Fast ForwardAWS re:Invent 2016 Fast Forward
AWS re:Invent 2016 Fast ForwardShuen-Huei Guan
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performancekaven yan
 
AWS Serverless patterns & best-practices in AWS
AWS Serverless  patterns & best-practices in AWSAWS Serverless  patterns & best-practices in AWS
AWS Serverless patterns & best-practices in AWSDima Pasko
 
Do You Need a Service Mesh? @ London Devops, January 2019
Do You Need a Service Mesh? @ London Devops, January 2019Do You Need a Service Mesh? @ London Devops, January 2019
Do You Need a Service Mesh? @ London Devops, January 2019Matt Turner
 
AWS Observability Made Simple
AWS Observability Made SimpleAWS Observability Made Simple
AWS Observability Made SimpleLuciano Mammino
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Startupfest
 

Ähnlich wie Queueing at the Checkout (20)

Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
 
Planning to Fail #phpne13
Planning to Fail #phpne13Planning to Fail #phpne13
Planning to Fail #phpne13
 
Ajax and PHP
Ajax and PHPAjax and PHP
Ajax and PHP
 
Otimizando servidores web
Otimizando servidores webOtimizando servidores web
Otimizando servidores web
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous Applications
 
Mazda siv - web services
Mazda   siv - web servicesMazda   siv - web services
Mazda siv - web services
 
Planning to Fail #phpuk13
Planning to Fail #phpuk13Planning to Fail #phpuk13
Planning to Fail #phpuk13
 
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNAFirst Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...
 
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
 
Real time web
Real time webReal time web
Real time web
 
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over WebsocketIntroduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
 
Scaling symfony apps
Scaling symfony appsScaling symfony apps
Scaling symfony apps
 
AWS re:Invent 2016 Fast Forward
AWS re:Invent 2016 Fast ForwardAWS re:Invent 2016 Fast Forward
AWS re:Invent 2016 Fast Forward
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performance
 
AWS Serverless patterns & best-practices in AWS
AWS Serverless  patterns & best-practices in AWSAWS Serverless  patterns & best-practices in AWS
AWS Serverless patterns & best-practices in AWS
 
Do You Need a Service Mesh? @ London Devops, January 2019
Do You Need a Service Mesh? @ London Devops, January 2019Do You Need a Service Mesh? @ London Devops, January 2019
Do You Need a Service Mesh? @ London Devops, January 2019
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
AWS Observability Made Simple
AWS Observability Made SimpleAWS Observability Made Simple
AWS Observability Made Simple
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
 

Kürzlich hochgeladen

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 

Kürzlich hochgeladen (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 

Queueing at the Checkout

  • 1. Queuing at the Checkout Bulgaria Web Summit 2015
  • 2. ★Chief Technical Architect at Reward Gateway ★Interested in scalability and engineering ★“PHP addict!” Who am I?
  • 3.
  • 4. <html>      <head>          <title>Tutorial</title>      </head>      <body>          <?php  echo  "<p>Hello  World</p>";  ?>      </body>   </html>  
  • 5. “Do not wait; the time will never be 'just right.' Start where you stand, and work with whatever tools you may have at your command, and better tools will be found as you go along.” American author, Napoleon Hill (1883-1970)
  • 6. A modern web application
  • 7. Modern applications are complex ★Modern web applications often do not work in isolation. ★Gone are the days of a single database powering everything. ★Integrate with Facebook, Stripe, etc. Your application Facebook Stripe Amazon S3Zendesk
  • 8. Adding an API ★Let’s add a new SOAP service to our application. <?xml  version="1.0"?>   <soap:Envelope   xmlns:soap="http://www.w3.org/2001/12/soap-­‐envelope"   soap:encodingStyle="http://www.w3.org/2001/12/soap-­‐encoding">   <soap:Body>      <m:GetName  xmlns:m="http://www.example.com/name">          <m:Item>John</m:Item>      </m:GetPrice>   </soap:Body>   </soap:Envelope>  
  • 9. Adding an API ★Let’s add a new SOAP service to our application. ★PHP makes this really easy!<?php   $client  =  new  SoapClient("http://www.example.com/some.wsdl");   echo  "Hi  "  .  $client-­‐>name()  .  "n";  
  • 10. Adding an API ★Let’s add a new SOAP service to our application. ★PHP makes this really easy! ★We can be in production in two minutes. $  php  client.php   Hi  John   $  php  client.php   Hi  Dave   $  php  client.php   Hi  Colin  
  • 11.
  • 15. Poor response times lead to loss of revenue ★The slower your site, the more likely people are to give up (“exit”) ★Over 75% of people in an Akami survey said they would stop using a site if it took longer than 4 seconds. ★The more people who give up, the less money you’ll make. ExitRate 0% 5% 10% 15% 20% Load Time (secs) 0 .1 1 2 3
  • 17. TL;DR ★Split your application into bits. ★Keep the predictable bit on the request path. ★Move the unpredictable bit somewhere else. ★Use a message queue to communicate between the two halves.
  • 18. Message Queue Servers ★There are lots of message queue implementations: ★ RabbitMQ ★ Amazon SQS ★ OpenAMQ ★ …. ★Written in different languages with different tradeoffs. ★Almost all support a protocol called AMQP.
  • 19. Message Queue Basics ★AMQP has three concepts. ★Exchanges route messages using rules ★Queues are where messages wait for processing ★Bindings define the routing rules Publisher Publisher Exchange Exchange Queue Queue Consumer Consumer Consumer
  • 20. Exchange Rules ★The exchanges understand three types of rule: ★ Fanout ★ Direct ★ Topic ★You can create almost any structure with this set. Publisher Exchange Queue Consumer Consumer Fanout Queue Publisher Exchange Queue Consumer Direct
  • 21. Exchange Rules Continued ★The exchanges understand three types of rule: ★ Fanout ★ Direct ★ Topic ★You can create almost any structure with this set. Publisher Exchange Queue Consumer Consumer Topic Queue lazy.# *.orange.* *.*.rabbit
  • 22. Basic Publisher <?php   require_once  __DIR__  .  '/vendor/autoload.php';   use  PhpAmqpLibConnectionAMQPConnection;   use  PhpAmqpLibMessageAMQPMessage;   $connection  =  new  AMQPConnection('localhost',  5672,  'guest',  ‘guest');   $channel  =  $connection-­‐>channel();   $channel-­‐>queue_declare('hello',  false,  false,  false,  false);   $msg  =  new  AMQPMessage('Hello  World!');   $channel-­‐>basic_publish($msg,  '',  'hello');   echo  "  [x]  Sent  'Hello  World!’n”;   $channel-­‐>close();   $connection-­‐>close();  
  • 23. Basic Consumer #!/usr/bin/env  python   import  pika   connection  =  pika.BlockingConnection(pika.ConnectionParameters(                  host='localhost'))   channel  =  connection.channel()   channel.queue_declare(queue='hello')   print  '  [*]  Waiting  for  messages.  To  exit  press  CTRL+C'   def  callback(ch,  method,  properties,  body):          print  "  [x]  Received  %r"  %  (body,)   channel.basic_consume(callback,                                              queue='hello',                                              no_ack=True)   channel.start_consuming()
  • 24. Still need to handle problems… ★You still have to monitor your queues. ★Easy to see when things go wrong. ★More advanced features let you cope with this better (e.g. timeouts on delivery) QueueSize(messages) 0 250 500 750 1,000 Requests (/secs) 0 10 0 20 0 30 0
  • 25. Still need to handle crashes… ★What happens when the message queue server crashes? ★ You also still need to worry about your data. ★By default, nothing is saved by RabbitMQ (i.e you lose everything.) ★Pay attention to durability settings when configuring the queues.
  • 27. “Bad API” ★http://badapi.trip.tv ★Allows you to send a request and get a known response back. ★Lets you specify how long to delay the response ★Lets you specify a HTTP error code ★Good for simulating a poorly performing API
  • 28. “RabbitMQ Simulator” ★http://tryrabbitmq.com ★Single page simulator for RabbitMQ ★Interactive user interface ★Lets you try out all the concepts in this talk and get comfortable with exchanges, bindings etc.
  • 29. Conclusion ★Keep your application predictable - move the unpredictable bit out. ★Your integration tests should consider API failures and performance problems. ★Command-Query Response Separation can really help in this area (another talk!) ★We’re hiring! http://rg.co/careers