Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PHP is the King, nodejs the prince and python the fool

1,134 views

Published on

I gave this presentation at Codemotion Rome, it's the a story on a monolithic architecture evolved to an SOA architecture.

Published in: Internet

PHP is the King, nodejs the prince and python the fool

  1. 1. ROME 27-28 march 2015 Alessandro Cinelli (cirpo) PHP is the king, nodejs is the prince, Python the fool
  2. 2. ROME 27-28 march 2015 Alessandro Cinelli (cirpo)
  3. 3. dubai
  4. 4. dubai
  5. 5. namshi
  6. 6. namshinamshi
  7. 7. Namshi almost 3 years old ~350 ppl IT team ~15 ppl million+ visits per month serving the UAE and GCC
  8. 8. ARCHITECTURE
  9. 9. a monolithic architecture
  10. 10. so far so good… but we started growing…
  11. 11. “we need a brand new feature for the warehouse…”
  12. 12. SOA
  13. 13. Service Oriented Architecture
  14. 14. “A software design based on discrete software components, "services", that collectively provide the functionalities of the larger software application” – A.Nadalin (@_odino_)
  15. 15. “Microservice Architecture" […] a particular way of designing software applications as suites of independently deployable services…” – M.Fowler FULL STACK IS DEAD!
  16. 16. services as LEGO bricks
  17. 17. UNIX Philosophy “Write programs that do one thing and do it well.”
  18. 18. SOA BENEFITS
  19. 19. SOA BENEFITS scalability
  20. 20. SOA BENEFITS scalability avoid single point of failure
  21. 21. SOA BENEFITS scalability avoid single point of failure easier and faster deploys
  22. 22. SOA BENEFITS scalability avoid single point of failure easier and faster deploys isolation
  23. 23. SOA BENEFITS scalability avoid single point of failure easier and faster deploys isolation maintainability
  24. 24. SOA BENEFITS scalability avoid single point of failure easier and faster deploys isolation maintainability easier to replace existing parts
  25. 25. How do you connect services?
  26. 26. HTTP A protocol that is almost 25 years old and is here to stay!
  27. 27. GET vs POST
  28. 28. GET vs POST “The difference is that in a GET request you have the parameters in the url , with a POST the parameters are in the request’s body” answered by 80% of candidates during the interview
  29. 29. “you don’t know HTTP? you shall not pass” - Gandalf
  30. 30. RabbitMq
  31. 31. using crons!
  32. 32. RabbitMq publish consume q u e u e
  33. 33. RabbitMq github.com/videlalvaro/php-amqplib
  34. 34. RabbitMq github.com/videlalvaro/php-amqplib
  35. 35. RabbitMq Language and protocol format agnostic
  36. 36. RabbitMq Language and protocol format agnostic You can easily create an event driven architecture
  37. 37. RabbitMq Language and protocol format agnostic You can easily create an event driven architecture Messages stay in the queue if a service goes down
  38. 38. RabbitMq Language and protocol format agnostic You can easily create an event driven architecture Messages stay in the queue if a service goes down Too many messages? add more consumers!
  39. 39. PHP
  40. 40. PHP It follows standards (PSR-*)
  41. 41. PHP It follows standards (PSR-*) Decoupled components
  42. 42. PHP It follows standards (PSR-*) Decoupled components Huge and active opensource community
  43. 43. PHP It follows standards (PSR-*) Decoupled components Huge and active opensource community Easy to plug in your domain code
  44. 44. PHP It follows standards (PSR-*) Decoupled components Huge and active opensource community Easy to plug in your domain code Not just a framework, but a project…
  45. 45. PHP It follows standards (PSR-*) Decoupled components Huge and active opensource community Easy to plug in your domain code Not just a framework, but a project… Designed starting from the HTTP protocol
  46. 46. PHP bundle -> app -> service
  47. 47. PHP UserBundle WarehouseBundle CheckoutBundle ProductBundle […]
  48. 48. Once you have a SOLID set of api foundation you can easily start building other awesome applications
  49. 49. PHP - Silex the PHP micro-framework based on Symfony2 Components
  50. 50. PHP - Silex
  51. 51. Let’s eat those apis!
  52. 52. Javascript
  53. 53. Javascript Two way data-binding Single page application Built-in services on top of XHR Routing Controller Model
  54. 54. Javascript Two way data-binding Single page application Built-in services on top of XHR Routing Controller Model it’s a MVW framework: Model-View-Whatever
  55. 55. Javascript
  56. 56. Javascript
  57. 57. Javascript
  58. 58. Javascript
  59. 59. party time!
  60. 60. FROM STATEFUL TO STATELESS Removed server sessions Sessions on the client (localstorage)
  61. 61. STATELESS JSON Web Signature http://tools.ietf.org/html/draft-jones-json-web-signature-04
  62. 62. PHP -JWS github.com/namshi/jose JOSÉ
  63. 63. PHP -JWS
  64. 64. PHP -JWS
  65. 65. double party time!
  66. 66. let’s do the same with the desktop website!
  67. 67. some customers were experiencing some issues…
  68. 68. JAVASCRIPT
  69. 69. JAVASCRIPT
  70. 70. JAVASCRIPT
  71. 71. we rebuilt the desktop website in two weeks!
  72. 72. JAVASCRIPT Rapid application development Quick setup Event driven Javascript! why node?
  73. 73. github.com/namshi/mockserver mockserver mock your APIs in a matter of seconds! JAVASCRIPT
  74. 74. JAVASCRIPT
  75. 75. JAVASCRIPT mockserver
  76. 76. JAVASCRIPT users_GET.mock file mockserver
  77. 77. JAVASCRIPT mockserver
  78. 78. JAVASCRIPT github.com/namshi/shisha shisha smoke tests made easy!
  79. 79. JAVASCRIPT shisha .smoke file
  80. 80. JAVASCRIPT shisha
  81. 81. REDIS
  82. 82. REDIS Key types: lists, hashes, sets, sorted sets
  83. 83. REDIS Key types: lists, hashes, sets, sorted sets Persistent to disk
  84. 84. REDIS Key types: lists, hashes, sets, sorted sets Persistent to disk Up to 512MB per key
  85. 85. REDIS Key types: lists, hashes, sets, sorted sets Persistent to disk Up to 512MB per key Pub/sub
  86. 86. REDIS Key types: lists, hashes, sets, sorted sets Persistent to disk Up to 512MB per key Pub/sub Transactions with optimistic locking
  87. 87. REDIS github.com/nrk/predis
  88. 88. PYTHON
  89. 89. PYTHON Data analysis Small app with flask Sys scripts
  90. 90. DOCKER
  91. 91. “Operating-system-level virtualization is a virtualization method where the kernel of an operating system allows for multiple isolated user space instances, instead of just one. Such instances, often called CONTAINERS, or jails, may look and feel like a real server from the point of view of its owners and users.” http://en.wikipedia.org/wiki/Docker_%28software%29
  92. 92. lego
  93. 93. ONE CONTAINER = ONE COMMAND
  94. 94. DIFFERENCE BETWEEN A VM AND DOCKER HOST OS GUEST OS HYPERVISOR BIN/ LIBS APP A APP C APP B GUEST OS BIN/ LIBS APP Z APP H APP B GUEST OS BIN/ LIBS APP A APP D APP L HOST OS DOCKER ENGINE BIN/ LIBS APP A BIN/ LIBS APP Z BIN/ LIBS APP D BIN/ LIBS APP B{ { VM
  95. 95. CURRENT ARCHITECTURE other clients
  96. 96. WHAT’S NEXT? (more) (maybe)
  97. 97. il mondo è bello perché è vario il mondo è bello perché è vario
  98. 98. il mondo è bello perché è vario open your mind…
  99. 99. use the right tool
  100. 100. you can solve problems in different ways
  101. 101. @cirpo github.com/cirpo /
  102. 102. thanks
  103. 103. tech.namshi.com/join-us tech.namshi.com github.com/namshi @TechNamshi we are hiring!
  104. 104. thanks
  105. 105. https://farm3.staticflickr.com/2199/2365883747_3a5c753719_o.jpg https://www.flickr.com/photos/karen_roe/8912245799 https://www.flickr.com/photos/anaxila/367953499/sizes/l https://www.flickr.com/photos/onigiri_chang/5356325784/sizes/o/ http://www.slideshare.net/odino/soa-with-symfony2-confoo-2014-in-montreal-ca https://www.flickr.com/photos/ejpphoto/2314610838/sizes/o/ https://www.flickr.com/photos/cesarastudillo/3981364314/sizes/l https://www.flickr.com/photos/piers_nye/2501994750/sizes/o/ https://www.flickr.com/photos/36247316@N00/3108399560/sizes/o/ https://www.flickr.com/photos/ironpoison_photos_69/9604127837/sizes/k/ https://www.flickr.com/photos/chrisschoenbohm/5104367911/sizes/l credits

×