Delaying Gratification
Using queues to build efficient systems
Copyright © 2014 Magento, Inc. All Rights Reserved.
Magento®, eBay Enterprise™ and their respective logos are trademarks, ...
Tom Lodge
Senior Magento eCommerce Architect Magento
ECG
tlodge@ebay.com
Kevin Schroeder
Technical Manager of Education and
Consulting
Magento ECG, MagentoU
keschroeder@ebay.com
@kpschrade
Business Case1
Welcome to BillyBobBBQs.com
• BillyBobBBQs.com
• Sell BBQs
• Sell a LOT of BBQs
The Board Expects
• Optimal Customer Experience
• Maximise Sales
• Minimise Costs
Simple stuff
• Payment Gateway
• ERP Integration
• Third Party Systems
Marketing promotes success
• BillyBobBBQs.com have a great PR team
• PR aren’t always able to predict success
• Chairman o...
Success can be a problem
• Site designed for a volume of traffic
• Chairman just invited USA to visit
• Site needs to scal...
OK so what next…
• Maintain Customer Experience
• Maximise Sales
• Minimise Costs
• Handle Spikes
Thinking About The Problem2
How we (like to) think about scaling
0
50
100
150
200
250
300
350
400
0
1
2
3
4
5
6
7
1
5
9
13
17
21
25
29
33
37
41
45
49
...
Billy Bob’s scaling experience
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51
Solution: Cloud
Server
Server
Timeline
Two Problems
1: Clouds still like predictability
Throughput
Capacity
2: We’ve only scaled web nodes
Server
Server
Server
Server
Server
Server
Server
Database
What does Billy Bob need?
A system that can temporarily manage peaks that
are beyond the synchronous capacity of the syste...
Defining A Solution3
Requirements
• MUST handle spikes without interfering with
the customer
• MUST mitigate spikes without overwhelming
the in...
Billy Bob needs a system like this
Throughput
Capacity
   
Options
Batching Queuing
Difference between batch and queue
Batch Queue
Difference between batch and queue
Batch Queue
Difference between batch and queue
Batch Queue
The Effect on Infrastructure
Batch Queue
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
wa
id
sy
us
0%
10%
20%
30%
40%
50%
60...
Batching QueuingQu
Implementing A Solution4
Front End Node
Worker Queue
Basic Work Flow
MUST handle spikes without interfering with the customer
MUST be able to use resources efficiently
MUST mitigate spikes wi...
Uni-Directional Job
Executed On The Frontend
Executed On The BackendUnit Testing Entry Point
Eg. 1 – Uni-Directional5
Bi-Directional Job
Executed In The Future
Bi-Directional Result Tickets
Get a result ticket
Job is returned when it
has finished executing
Eg.2 – Bi-Directional
Blocking/Non-Blocking
6
Integration with Magento7
How can Billy Bob use this?
1. Initiate jobs at controller_action_predispatch for consumption during
block rendering
2. Ex...
https://github.com/kschroeder/Magento-Worker-Queue_POC
Questions9
Thanks
Tom Lodge
Senior Magento eCommerce Architect
Magento ECG
tlodge@ebay.com
Kevin Schroeder
Technical Manager of Educa...
Delaying Gratification: Using queues to build efficient systems
Upcoming SlideShare
Loading in …5
×

Delaying Gratification: Using queues to build efficient systems

6,135 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,135
On SlideShare
0
From Embeds
0
Number of Embeds
4,445
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Delaying Gratification: Using queues to build efficient systems

  1. 1. Delaying Gratification Using queues to build efficient systems
  2. 2. Copyright © 2014 Magento, Inc. All Rights Reserved. Magento®, eBay Enterprise™ and their respective logos are trademarks, service marks, registered trademarks, or registered service marks of eBay, Inc. or its subsidiaries. Other trademarks or service marks contained in this presentation are the property of the respective companies with which they are associated. This presentation is for informational and discussion purposes only and should not be construed as a commitment of Magento, Inc. or GSI Commerce, Inc. d/b/a eBay Enterprise (“eBay Enterprise”) or of any of their subsidiaries or affiliates. While we attempt to ensure the accuracy, completeness and adequacy of this presentation, neither Magento, Inc., eBay Enterprise nor any of their subsidiaries or affiliates are responsible for any errors or will be liable for the use of, or reliance upon, this presentation or any of the information contained in it. Unauthorized use, disclosure or dissemination of this information is expressly prohibited.
  3. 3. Tom Lodge Senior Magento eCommerce Architect Magento ECG tlodge@ebay.com
  4. 4. Kevin Schroeder Technical Manager of Education and Consulting Magento ECG, MagentoU keschroeder@ebay.com @kpschrade
  5. 5. Business Case1
  6. 6. Welcome to BillyBobBBQs.com • BillyBobBBQs.com • Sell BBQs • Sell a LOT of BBQs
  7. 7. The Board Expects • Optimal Customer Experience • Maximise Sales • Minimise Costs
  8. 8. Simple stuff • Payment Gateway • ERP Integration • Third Party Systems
  9. 9. Marketing promotes success • BillyBobBBQs.com have a great PR team • PR aren’t always able to predict success • Chairman on Good Morning America
  10. 10. Success can be a problem • Site designed for a volume of traffic • Chairman just invited USA to visit • Site needs to scale • Max Sales, Min Cost
  11. 11. OK so what next… • Maintain Customer Experience • Maximise Sales • Minimise Costs • Handle Spikes
  12. 12. Thinking About The Problem2
  13. 13. How we (like to) think about scaling 0 50 100 150 200 250 300 350 400 0 1 2 3 4 5 6 7 1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 97 Capacity Traffic
  14. 14. Billy Bob’s scaling experience 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51
  15. 15. Solution: Cloud Server Server Timeline
  16. 16. Two Problems
  17. 17. 1: Clouds still like predictability Throughput Capacity
  18. 18. 2: We’ve only scaled web nodes Server Server Server Server Server Server Server Database
  19. 19. What does Billy Bob need? A system that can temporarily manage peaks that are beyond the synchronous capacity of the system while retaining functionality and responsiveness In other words we are talking about scalability not performance
  20. 20. Defining A Solution3
  21. 21. Requirements • MUST handle spikes without interfering with the customer • MUST mitigate spikes without overwhelming the infrastructure • MUST be able to use resources efficiently
  22. 22. Billy Bob needs a system like this Throughput Capacity    
  23. 23. Options Batching Queuing
  24. 24. Difference between batch and queue Batch Queue
  25. 25. Difference between batch and queue Batch Queue
  26. 26. Difference between batch and queue Batch Queue
  27. 27. The Effect on Infrastructure Batch Queue 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% wa id sy us 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% wa id sy us
  28. 28. Batching QueuingQu
  29. 29. Implementing A Solution4
  30. 30. Front End Node Worker Queue Basic Work Flow
  31. 31. MUST handle spikes without interfering with the customer MUST be able to use resources efficiently MUST mitigate spikes without overwhelming the infrastructure
  32. 32. Uni-Directional Job Executed On The Frontend Executed On The BackendUnit Testing Entry Point
  33. 33. Eg. 1 – Uni-Directional5
  34. 34. Bi-Directional Job Executed In The Future
  35. 35. Bi-Directional Result Tickets Get a result ticket Job is returned when it has finished executing
  36. 36. Eg.2 – Bi-Directional Blocking/Non-Blocking 6
  37. 37. Integration with Magento7
  38. 38. How can Billy Bob use this? 1. Initiate jobs at controller_action_predispatch for consumption during block rendering 2. Execute multiple concurrent data requests from web services 3. Initiate data retrieval for retrieval in subsequent Ajax requests 4. Implement an ordering mechanism that throttles order processing (beware of PCI issues here, obviously) 5. Update ERP systems immediately with no client interruption 6. Ideas?
  39. 39. https://github.com/kschroeder/Magento-Worker-Queue_POC
  40. 40. Questions9
  41. 41. Thanks Tom Lodge Senior Magento eCommerce Architect Magento ECG tlodge@ebay.com Kevin Schroeder Technical Manager of Education and Consulting Magento ECG, MagentoU keschroeder@ebay.com @kpschrade

×