Cloud Messaging with                           Cloud Foundry                           Álvaro Videla - VMware             ...
About Me                • Developer Advocate for Cloud Foundry                • Blog: http://videlalvaro.github.com/      ...
About Me                •   Developer Advocate for Cloud Foundry                •   Blog: http://videlalvaro.github.com/  ...
About Me            Co-authored            RabbitMQ in Action              http://bit.ly/rabbitmq                         ...
Classic Apps                                          5Tuesday, November 13, 12
Implement a                           Photo GalleryTuesday, November 13, 12
Two Parts:Tuesday, November 13, 12
Pretty SimpleTuesday, November 13, 12
‘Till new                           requirements arriveTuesday, November 13, 12
The Product OwnerTuesday, November 13, 12
Can we also notify the                   user friends when she                   uploads a new image?Tuesday, November 13,...
Can we also notify the                   user friends when she                   uploads a new image?      I forgot to men...
Tuesday, November 13, 12
The Social Media GuruTuesday, November 13, 12
We need to give badges                  to users for each                   picture uploadTuesday, November 13, 12
We need to give badges                  to users for each                   picture upload                           and p...
Tuesday, November 13, 12
The SysadminTuesday, November 13, 12
Dumb! You’re delivering                   full size images!                The bandwidth bill has                        t...
Dumb! You’re delivering                   full size images!                The bandwidth bill has                        t...
Tuesday, November 13, 12
The Developer in the                          other teamTuesday, November 13, 12
I need to call your PHP                  stuff but from PythonTuesday, November 13, 12
I need to call your PHP                  stuff but from Python                           And also Java starting next weekT...
Tuesday, November 13, 12
The UserTuesday, November 13, 12
I don’t want to wait                           till your app resizes                                 my image!Tuesday, Nov...
YouTuesday, November 13, 12
Tuesday, November 13, 12
Let’s see the                           code evolution                                            30Tuesday, November 13, 12
Pseudo Code                               Comments           %% image_controller           handle(PUT, "/user/image", ReqD...
Pseudo Code                             Function Name           %% image_controller           handle(PUT, "/user/image", R...
Pseudo Code                               Arguments           %% image_controller           handle(PUT, "/user/image", Req...
Pseudo Code                             Function Body           %% image_controller           handle(PUT, "/user/image", R...
Pseudo Code                              Return Value           %% image_controller           handle(PUT, "/user/image", R...
First Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             image_han...
Second Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             {ok, Ima...
Third Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             {ok, Imag...
Fourth Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             {ok, Ima...
Final Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             {ok, Imag...
Can our code scale to                   new requirements?                                          41Tuesday, November 13,...
What if                           42Tuesday, November 13, 12
What if                • We need to speed up image conversion                                                         43Tu...
What if                • We need to speed up image conversion                • User notification has to be sent by email  ...
What if                • We need to speed up image conversion                • User notification has to be sent by email  ...
What if                •   We need to speed up image conversion                •   User notification has to be sent by ema...
What if                •   We need to speed up image conversion                •   User notification has to be sent by ema...
What if                •   We need to speed up image conversion                •   User notification has to be sent by ema...
Can we do better?                                               49Tuesday, November 13, 12
Sure.                           Using messaging                                             50Tuesday, November 13, 12
Design                           Publish / Subscribe PatternTuesday, November 13, 12
First Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             {ok, Imag...
First Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             {ok, Imag...
First Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             {ok, Imag...
First Implementation:           %% image_controller           handle(PUT, "/user/image", ReqData) ->             {ok, Imag...
Second Implementation:Tuesday, November 13, 12
Second Implementation:                           THIS PAGE INTENTIONALLY LEFT BLANKTuesday, November 13, 12
Tuesday, November 13, 12
Messaging                           59Tuesday, November 13, 12
Messaging                • Share data across processes                                                60Tuesday, November ...
Messaging                • Share data across processes                • Processes can be part of different apps           ...
Messaging                • Share data across processes                • Processes can be part of different apps           ...
Messaging                •   Share data across processes                •   Processes can be part of different apps       ...
Main Concepts                           64Tuesday, November 13, 12
Main Concepts                • Messages are sent by Producers                                                   65Tuesday,...
Main Concepts                • Messages are sent by Producers                • Messages are delivered to Consumers        ...
How can we                 start using messaging                         today?                                         67...
Enter                                   68Tuesday, November 13, 12
Why Cloud Foundry is                        Good™                    for Messaging?                                       ...
Key aspects of Cloud Foundry                                    70Tuesday, November 13, 12
Key aspects of Cloud Foundry     • Supports many apps per account                                        71Tuesday, Novemb...
Key aspects of Cloud Foundry     • Supports many apps per account     • Supports many services per account                ...
Key aspects of Cloud Foundry     • Supports many apps per account     • Supports many services per account     • Services ...
Key aspects of Cloud Foundry     •   Supports many apps per account     •   Supports many services per account     •   Ser...
Intermission:                            What is                           RabbitMQ                                      7...
RabbitMQ                           76Tuesday, November 13, 12
RabbitMQ     • Multi Protocol Messaging Server                                         77Tuesday, November 13, 12
RabbitMQ     • Multi Protocol Messaging Server     • Open Source (MPL)                                         78Tuesday, ...
RabbitMQ     • Multi Protocol Messaging Server     • Open Source (MPL)     • Part of Spring Source                        ...
RabbitMQ     •   Multi Protocol Messaging Server     •   Open Source (MPL)     •   Part of Spring Source     •   Supports ...
RabbitMQ     •   Multi Protocol Messaging Server     •   Open Source (MPL)     •   Part of Spring Source     •   Supports ...
TELL ME MORE                                          82Tuesday, November 13, 12
TELL ME MORE                             RabbitMQ Simulator Demo                                                       83T...
Sample App: CloudStagram                                84Tuesday, November 13, 12
Sample App: CloudStagram                                85Tuesday, November 13, 12
Sample App: CloudStagram                                86Tuesday, November 13, 12
Sample App: CloudStagram                                87Tuesday, November 13, 12
Sample App: CloudStagram                                88Tuesday, November 13, 12
Sample App: CloudStagram                                89Tuesday, November 13, 12
Sample App: CloudStagram                                90Tuesday, November 13, 12
Sample App: CloudStagram    Frontend App          node.js                                91Tuesday, November 13, 12
Sample App: CloudStagram    Frontend App          node.js            Image Resizers                   node.js             ...
Sample App: CloudStagram    Frontend App          node.js            Image Resizers                   Clojure             ...
CODE OR        IT DIDN’T HAPPEN                           94Tuesday, November 13, 12
CODA                                  95Tuesday, November 13, 12
Messaging                                96Tuesday, November 13, 12
Scale                    Messaging                                97Tuesday, November 13, 12
Scale      Decoupling                    Messaging                                        98Tuesday, November 13, 12
Scale             Decoupling                    Messaging                           Polyglot                              ...
100Tuesday, November 13, 12
Heavy                  Lifting                            101Tuesday, November 13, 12
Heavy     Multi                  Lifting   Apps                                    102Tuesday, November 13, 12
Heavy     Multi                  Lifting   Apps             Multi            Services                                    1...
Heavy       Multi                  Lifting     Apps             Multi            Cloud            Services        Messagin...
Sign Up Today                     https://my.cloudfoundry.com/signup                                                      ...
Questions?                                        106Tuesday, November 13, 12
Thanks!                                    Álvaro Videla                              http://twitter.com/old_sound        ...
Upcoming SlideShare
Loading in …5
×

Cloud Messaging With Cloud Foundry

3,341 views
3,431 views

Published on

The Pub/Sub Pattern Image is taken from here: http://www.eaipatterns.com/PublishSubscribeChannel.html

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,341
On SlideShare
0
From Embeds
0
Number of Embeds
564
Actions
Shares
0
Downloads
53
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Cloud Messaging With Cloud Foundry

  1. 1. Cloud Messaging with Cloud Foundry Álvaro Videla - VMware © 2012 VMware, Inc. All rights reserved.Tuesday, November 13, 12
  2. 2. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_sound 2Tuesday, November 13, 12
  3. 3. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_sound • I created gifsockets™ 3Tuesday, November 13, 12
  4. 4. About Me Co-authored RabbitMQ in Action http://bit.ly/rabbitmq 4Tuesday, November 13, 12
  5. 5. Classic Apps 5Tuesday, November 13, 12
  6. 6. Implement a Photo GalleryTuesday, November 13, 12
  7. 7. Two Parts:Tuesday, November 13, 12
  8. 8. Pretty SimpleTuesday, November 13, 12
  9. 9. ‘Till new requirements arriveTuesday, November 13, 12
  10. 10. The Product OwnerTuesday, November 13, 12
  11. 11. Can we also notify the user friends when she uploads a new image?Tuesday, November 13, 12
  12. 12. Can we also notify the user friends when she uploads a new image? I forgot to mention we need it for tomorrow…Tuesday, November 13, 12
  13. 13. Tuesday, November 13, 12
  14. 14. The Social Media GuruTuesday, November 13, 12
  15. 15. We need to give badges to users for each picture uploadTuesday, November 13, 12
  16. 16. We need to give badges to users for each picture upload and post uploads to TwitterTuesday, November 13, 12
  17. 17. Tuesday, November 13, 12
  18. 18. The SysadminTuesday, November 13, 12
  19. 19. Dumb! You’re delivering full size images! The bandwidth bill has tripled!Tuesday, November 13, 12
  20. 20. Dumb! You’re delivering full size images! The bandwidth bill has tripled! We need this fixed for yesterday!Tuesday, November 13, 12
  21. 21. Tuesday, November 13, 12
  22. 22. The Developer in the other teamTuesday, November 13, 12
  23. 23. I need to call your PHP stuff but from PythonTuesday, November 13, 12
  24. 24. I need to call your PHP stuff but from Python And also Java starting next weekTuesday, November 13, 12
  25. 25. Tuesday, November 13, 12
  26. 26. The UserTuesday, November 13, 12
  27. 27. I don’t want to wait till your app resizes my image!Tuesday, November 13, 12
  28. 28. YouTuesday, November 13, 12
  29. 29. Tuesday, November 13, 12
  30. 30. Let’s see the code evolution 30Tuesday, November 13, 12
  31. 31. Pseudo Code Comments %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Tuesday, November 13, 12
  32. 32. Pseudo Code Function Name %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Tuesday, November 13, 12
  33. 33. Pseudo Code Arguments %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Tuesday, November 13, 12
  34. 34. Pseudo Code Function Body %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Tuesday, November 13, 12
  35. 35. Pseudo Code Return Value %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Tuesday, November 13, 12
  36. 36. First Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Tuesday, November 13, 12
  37. 37. Second Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), ok.Tuesday, November 13, 12
  38. 38. Third Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), notify_friends(ReqData:get_user()), ok.Tuesday, November 13, 12
  39. 39. Fourth Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), notify_friends(ReqData:get_user()), add_points_to_user(ReqData:get_user()), ok.Tuesday, November 13, 12
  40. 40. Final Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), notify_friends(ReqData:get_user()), add_points_to_user(ReqData:get_user()), tweet_new_image(User, Image), ok.Tuesday, November 13, 12
  41. 41. Can our code scale to new requirements? 41Tuesday, November 13, 12
  42. 42. What if 42Tuesday, November 13, 12
  43. 43. What if • We need to speed up image conversion 43Tuesday, November 13, 12
  44. 44. What if • We need to speed up image conversion • User notification has to be sent by email 44Tuesday, November 13, 12
  45. 45. What if • We need to speed up image conversion • User notification has to be sent by email • Stop tweeting about new images 45Tuesday, November 13, 12
  46. 46. What if • We need to speed up image conversion • User notification has to be sent by email • Stop tweeting about new images • Resize in different formats 46Tuesday, November 13, 12
  47. 47. What if • We need to speed up image conversion • User notification has to be sent by email • Stop tweeting about new images • Resize in different formats • Swap Language / Technology 47Tuesday, November 13, 12
  48. 48. What if • We need to speed up image conversion • User notification has to be sent by email • Stop tweeting about new images • Resize in different formats • Swap Language / Technology (No Down Time) 48Tuesday, November 13, 12
  49. 49. Can we do better? 49Tuesday, November 13, 12
  50. 50. Sure. Using messaging 50Tuesday, November 13, 12
  51. 51. Design Publish / Subscribe PatternTuesday, November 13, 12
  52. 52. First Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), Msg = #msg{user = ReqData:get_user(), image = Image}, publish_message(new_image, Msg).Tuesday, November 13, 12
  53. 53. First Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), Msg = #msg{user = ReqData:get_user(), image = Image}, publish_message(new_image, Msg). %% friends notifier on(new_image, Msg) -> notify_friends(Msg.user, Msg.image).Tuesday, November 13, 12
  54. 54. First Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), Msg = #msg{user = ReqData:get_user(), image = Image}, publish_message(new_image, Msg). %% friends notifier on(new_image, Msg) -> notify_friends(Msg.user, Msg.image). %% points manager on(new_image, Msg) -> add_points(Msg.user, new_image).Tuesday, November 13, 12
  55. 55. First Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), Msg = #msg{user = ReqData:get_user(), image = Image}, publish_message(new_image, Msg). %% friends notifier on(new_image, Msg) -> notify_friends(Msg.user, Msg.image). %% points manager on(new_image, Msg) -> add_points(Msg.user, new_image). %% resizer on(new_image, Msg) -> resize_image(Msg.image).Tuesday, November 13, 12
  56. 56. Second Implementation:Tuesday, November 13, 12
  57. 57. Second Implementation: THIS PAGE INTENTIONALLY LEFT BLANKTuesday, November 13, 12
  58. 58. Tuesday, November 13, 12
  59. 59. Messaging 59Tuesday, November 13, 12
  60. 60. Messaging • Share data across processes 60Tuesday, November 13, 12
  61. 61. Messaging • Share data across processes • Processes can be part of different apps 61Tuesday, November 13, 12
  62. 62. Messaging • Share data across processes • Processes can be part of different apps • Apps can live in different machines 62Tuesday, November 13, 12
  63. 63. Messaging • Share data across processes • Processes can be part of different apps • Apps can live in different machines • Communication is Asynchronous 63Tuesday, November 13, 12
  64. 64. Main Concepts 64Tuesday, November 13, 12
  65. 65. Main Concepts • Messages are sent by Producers 65Tuesday, November 13, 12
  66. 66. Main Concepts • Messages are sent by Producers • Messages are delivered to Consumers 66Tuesday, November 13, 12
  67. 67. How can we start using messaging today? 67Tuesday, November 13, 12
  68. 68. Enter 68Tuesday, November 13, 12
  69. 69. Why Cloud Foundry is Good™ for Messaging? 69Tuesday, November 13, 12
  70. 70. Key aspects of Cloud Foundry 70Tuesday, November 13, 12
  71. 71. Key aspects of Cloud Foundry • Supports many apps per account 71Tuesday, November 13, 12
  72. 72. Key aspects of Cloud Foundry • Supports many apps per account • Supports many services per account 72Tuesday, November 13, 12
  73. 73. Key aspects of Cloud Foundry • Supports many apps per account • Supports many services per account • Services can be shared across apps 73Tuesday, November 13, 12
  74. 74. Key aspects of Cloud Foundry • Supports many apps per account • Supports many services per account • Services can be shared across apps • Supports RabbitMQ by default 74Tuesday, November 13, 12
  75. 75. Intermission: What is RabbitMQ 75Tuesday, November 13, 12
  76. 76. RabbitMQ 76Tuesday, November 13, 12
  77. 77. RabbitMQ • Multi Protocol Messaging Server 77Tuesday, November 13, 12
  78. 78. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) 78Tuesday, November 13, 12
  79. 79. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Part of Spring Source 79Tuesday, November 13, 12
  80. 80. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Part of Spring Source • Supports AMQP, STOMP, MQTT 80Tuesday, November 13, 12
  81. 81. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Part of Spring Source • Supports AMQP, STOMP, MQTT • Has Clients for Many Platforms: Java, Ruby, node.js, PHP, Erlang, .Net., more 81Tuesday, November 13, 12
  82. 82. TELL ME MORE 82Tuesday, November 13, 12
  83. 83. TELL ME MORE RabbitMQ Simulator Demo 83Tuesday, November 13, 12
  84. 84. Sample App: CloudStagram 84Tuesday, November 13, 12
  85. 85. Sample App: CloudStagram 85Tuesday, November 13, 12
  86. 86. Sample App: CloudStagram 86Tuesday, November 13, 12
  87. 87. Sample App: CloudStagram 87Tuesday, November 13, 12
  88. 88. Sample App: CloudStagram 88Tuesday, November 13, 12
  89. 89. Sample App: CloudStagram 89Tuesday, November 13, 12
  90. 90. Sample App: CloudStagram 90Tuesday, November 13, 12
  91. 91. Sample App: CloudStagram Frontend App node.js 91Tuesday, November 13, 12
  92. 92. Sample App: CloudStagram Frontend App node.js Image Resizers node.js 92Tuesday, November 13, 12
  93. 93. Sample App: CloudStagram Frontend App node.js Image Resizers Clojure 93Tuesday, November 13, 12
  94. 94. CODE OR IT DIDN’T HAPPEN 94Tuesday, November 13, 12
  95. 95. CODA 95Tuesday, November 13, 12
  96. 96. Messaging 96Tuesday, November 13, 12
  97. 97. Scale Messaging 97Tuesday, November 13, 12
  98. 98. Scale Decoupling Messaging 98Tuesday, November 13, 12
  99. 99. Scale Decoupling Messaging Polyglot 99Tuesday, November 13, 12
  100. 100. 100Tuesday, November 13, 12
  101. 101. Heavy Lifting 101Tuesday, November 13, 12
  102. 102. Heavy Multi Lifting Apps 102Tuesday, November 13, 12
  103. 103. Heavy Multi Lifting Apps Multi Services 103Tuesday, November 13, 12
  104. 104. Heavy Multi Lifting Apps Multi Cloud Services Messaging 104Tuesday, November 13, 12
  105. 105. Sign Up Today https://my.cloudfoundry.com/signup 105Tuesday, November 13, 12
  106. 106. Questions? 106Tuesday, November 13, 12
  107. 107. Thanks! Álvaro Videla http://twitter.com/old_sound http://github.com/videlalvaro http://www.slideshare.net/old_sound 107Tuesday, November 13, 12

×