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 is the Prince and Lua is the fool

4,268 views

Published on

PHP is the King, nodejs is the Prince and Lua is the fool.

An overview about how the IT architecture changed at Namshi, a fashion e-commerce based in Dubai

Published in: Internet

PHP is the King, nodejs is the Prince and Lua is the fool

  1. 1. PHP is the king, nodejs is the prince, Lua is the fool @cirpo
  2. 2. dubai
  3. 3. dubai
  4. 4. namshi
  5. 5. namshi
  6. 6. Namshi almost 3 years old ~200 ppl IT team ~15 ppl million+ visits per month serving the UAE and GCC
  7. 7. PHP
  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 scalability avoid single point of failure easier and faster deploys isolation maintainability easier to replace existing parts
  19. 19. How do you connect services?
  20. 20. HTTP A protocol that is almost 25 years old and is here to stay!
  21. 21. 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
  22. 22. “you don’t know HTTP? you shall not pass” ! ! - Gandalf
  23. 23. RabbitMQ
  24. 24. using crons!
  25. 25. RabbitMQ q u e u e publish consume
  26. 26. RabbitMQ github.com/videlalvaro/php-amqplib
  27. 27. RabbitMQ
  28. 28. 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!
  29. 29. PHP
  30. 30. 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
  31. 31. PHP - bundle -> app -> service
  32. 32. PHP - UserBundle WarehouseBundle CheckoutBundle ProductBundle […]
  33. 33. Once you have a SOLID set of api foundation you can easily start building other awesome applications
  34. 34. PHP - Silex the PHP micro-framework based on Symfony2 Components
  35. 35. PHP - Silex
  36. 36. Let’s eat those apis!
  37. 37. Javascript
  38. 38. 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
  39. 39. Javascript
  40. 40. Javascript
  41. 41. Javascript
  42. 42. Javascript
  43. 43. party time!
  44. 44. from stateful to stateless Removed server sessions Sessions on the client (localstorage)
  45. 45. Stateless JSON Web Signature http://tools.ietf.org/html/draft-jones-json-web-signature-04
  46. 46. PHP - JWS JOSÉ github.com/namshi/jose
  47. 47. PHP - JWS
  48. 48. PHP - JWS
  49. 49. double party time!
  50. 50. let’s do the same with the desktop website!
  51. 51. some customers were experiencing some issues…
  52. 52. javascript
  53. 53. javascript -
  54. 54. javascript -
  55. 55. we rebuilt the desktop website in two weeks!
  56. 56. javascript - why node? Rapid application development Quick setup Event driven Javascript!
  57. 57. javascript - mockserver mock your APIs in a matter of seconds! github.com/namshi/mockserver
  58. 58. javascript - mockserver
  59. 59. javascript - users_GET.mock file mockserver
  60. 60. javascript - mockserver
  61. 61. Javascript - shisha smoke tests made easy! github.com/namshi/shisha
  62. 62. Javascript - shisha .smoke file
  63. 63. Javascript - shisha
  64. 64. redis
  65. 65. redis Key types: lists, hashes, sets, sorted sets Persistent to disk Up to 512MB per key Pub/sub Transactions with optimistic locking Lua scripting embedded
  66. 66. redis github.com/nrk/predis
  67. 67. lua
  68. 68. lua
  69. 69. actual architecture other clients
  70. 70. what’s next?
  71. 71. what’s next?
  72. 72. what’s next?
  73. 73. we love php because
  74. 74. il mondo è bello perché è vario
  75. 75. open your mind…
  76. 76. use the right tool
  77. 77. you can solve problems in different ways
  78. 78. / github.com/cirpo @cirpo http://joind.in/talk/view/11477
  79. 79. thanks
  80. 80. tech.namsi.com/join-us tech.namshi.com github.com/namshi @TechNamshi we are hiring!
  81. 81. tech.namsi.com/join-us tech.namshi.com github.com/namshi @TechNamshi we are hiring!
  82. 82. thanks
  83. 83. credits 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/chr!isschoenbohm/5104367911/sizes/l

×