92
PHP is the king, nodejs is the prince, Lua is the fool @cirpo

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

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: PHP is the King, nodejs is the Prince and Lua is the fool

PHP is the king,

nodejs is the prince, Lua is the fool

@cirpo

Page 2: PHP is the King, nodejs is the Prince and Lua is the fool
Page 3: PHP is the King, nodejs is the Prince and Lua is the fool
Page 4: PHP is the King, nodejs is the Prince and Lua is the fool

dubai

Page 5: PHP is the King, nodejs is the Prince and Lua is the fool

dubai

Page 6: PHP is the King, nodejs is the Prince and Lua is the fool

namshi

Page 7: PHP is the King, nodejs is the Prince and Lua is the fool

namshi

Page 8: PHP is the King, nodejs is the Prince and Lua is the fool

Namshi

almost 3 years old

~200 ppl

IT team ~15 ppl

million+ visits per month

serving the UAE and GCC

Page 9: PHP is the King, nodejs is the Prince and Lua is the fool
Page 10: PHP is the King, nodejs is the Prince and Lua is the fool
Page 11: PHP is the King, nodejs is the Prince and Lua is the fool
Page 12: PHP is the King, nodejs is the Prince and Lua is the fool
Page 13: PHP is the King, nodejs is the Prince and Lua is the fool
Page 14: PHP is the King, nodejs is the Prince and Lua is the fool
Page 15: PHP is the King, nodejs is the Prince and Lua is the fool

PHP

Page 16: PHP is the King, nodejs is the Prince and Lua is the fool

architecture

Page 17: PHP is the King, nodejs is the Prince and Lua is the fool

a monolithic architecture

Page 18: PHP is the King, nodejs is the Prince and Lua is the fool

so far so good… but we started growing…

Page 19: PHP is the King, nodejs is the Prince and Lua is the fool

“we need a brand new feature for the warehouse…”

Page 20: PHP is the King, nodejs is the Prince and Lua is the fool

SOA

Page 21: PHP is the King, nodejs is the Prince and Lua is the fool

Service Oriented Architecture

Page 22: PHP is the King, nodejs is the Prince and Lua is the fool

– A.Nadalin (@_odino)

“A software design based on discrete software components, "services", that collectively

provide the functionalities of the larger software application”

Page 23: PHP is the King, nodejs is the Prince and Lua is the fool

– M.Fowler

“Microservice Architecture" […] a particular way of designing software applications as suites of

independently deployable services…” !

Full Stack is dead!

Page 24: PHP is the King, nodejs is the Prince and Lua is the fool

services as Lego bricks

Page 25: PHP is the King, nodejs is the Prince and Lua is the fool

Unix philosophy

“Write programs that do one thing and do it well.”

Page 26: PHP is the King, nodejs is the Prince and Lua is the fool

SOA benefits

scalability avoid single point of failure easier and faster deploys isolation maintainability easier to replace existing parts

Page 27: PHP is the King, nodejs is the Prince and Lua is the fool

How do you connect services?

Page 28: PHP is the King, nodejs is the Prince and Lua is the fool

HTTP

A protocol that is almost 25 years old and is here to stay!

Page 29: PHP is the King, nodejs is the Prince and Lua is the fool

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

Page 30: PHP is the King, nodejs is the Prince and Lua is the fool
Page 31: PHP is the King, nodejs is the Prince and Lua is the fool

“you don’t know HTTP? you shall not pass” !

!

- Gandalf

Page 32: PHP is the King, nodejs is the Prince and Lua is the fool

RabbitMQ

Page 33: PHP is the King, nodejs is the Prince and Lua is the fool

using crons!

Page 34: PHP is the King, nodejs is the Prince and Lua is the fool

RabbitMQ

publish consume

q u e u e

Page 35: PHP is the King, nodejs is the Prince and Lua is the fool

RabbitMQ

github.com/videlalvaro/php-amqplib

Page 36: PHP is the King, nodejs is the Prince and Lua is the fool

RabbitMQ

Page 37: PHP is the King, nodejs is the Prince and Lua is the fool

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!

Page 38: PHP is the King, nodejs is the Prince and Lua is the fool

PHP

Page 39: PHP is the King, nodejs is the Prince and Lua is the fool

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

Page 40: PHP is the King, nodejs is the Prince and Lua is the fool

PHP -

bundle -> app -> service

Page 41: PHP is the King, nodejs is the Prince and Lua is the fool

PHP -

UserBundle

WarehouseBundle

CheckoutBundle

ProductBundle

[…]

Page 42: PHP is the King, nodejs is the Prince and Lua is the fool

Once you have a SOLID set of api foundation you can easily start building other awesome applications

Page 43: PHP is the King, nodejs is the Prince and Lua is the fool

PHP - Silex

the PHP micro-framework based on Symfony2 Components

Page 44: PHP is the King, nodejs is the Prince and Lua is the fool

PHP - Silex

Page 45: PHP is the King, nodejs is the Prince and Lua is the fool

Let’s eat those apis!

Page 46: PHP is the King, nodejs is the Prince and Lua is the fool

Javascript

Page 47: PHP is the King, nodejs is the Prince and Lua is the fool

JavascriptTwo way data-binding

Single page application Built-in services on top of XHR

Routing Controller

Model it’s a MVW framework: Model-View-Whatever

Page 48: PHP is the King, nodejs is the Prince and Lua is the fool

Javascript

Page 49: PHP is the King, nodejs is the Prince and Lua is the fool

Javascript

Page 50: PHP is the King, nodejs is the Prince and Lua is the fool

Javascript

Page 51: PHP is the King, nodejs is the Prince and Lua is the fool

Javascript

Page 52: PHP is the King, nodejs is the Prince and Lua is the fool

party time!

Page 53: PHP is the King, nodejs is the Prince and Lua is the fool

from stateful to stateless

Removed server sessions Sessions on the client (localstorage)

Page 54: PHP is the King, nodejs is the Prince and Lua is the fool

Stateless

JSON Web Signaturehttp://tools.ietf.org/html/draft-jones-json-web-signature-04

Page 55: PHP is the King, nodejs is the Prince and Lua is the fool

PHP - JWS

github.com/namshi/jose

JOSÉ

Page 56: PHP is the King, nodejs is the Prince and Lua is the fool

PHP - JWS

Page 57: PHP is the King, nodejs is the Prince and Lua is the fool

PHP - JWS

Page 58: PHP is the King, nodejs is the Prince and Lua is the fool

double party time!

Page 59: PHP is the King, nodejs is the Prince and Lua is the fool

let’s do the same with the desktop website!

Page 60: PHP is the King, nodejs is the Prince and Lua is the fool

some customers were experiencing some issues…

Page 61: PHP is the King, nodejs is the Prince and Lua is the fool

javascript

Page 62: PHP is the King, nodejs is the Prince and Lua is the fool

javascript -

Page 63: PHP is the King, nodejs is the Prince and Lua is the fool

javascript -

Page 64: PHP is the King, nodejs is the Prince and Lua is the fool

we rebuilt the desktop website in two weeks!

Page 65: PHP is the King, nodejs is the Prince and Lua is the fool

javascript -

Rapid application development Quick setup Event driven Javascript!

why node?

Page 66: PHP is the King, nodejs is the Prince and Lua is the fool

javascript -

github.com/namshi/mockserver

mockserver mock your APIs in a matter of seconds!

Page 67: PHP is the King, nodejs is the Prince and Lua is the fool

javascript -

mockserver

Page 68: PHP is the King, nodejs is the Prince and Lua is the fool

javascript - users_GET.mock file

mockserver

Page 69: PHP is the King, nodejs is the Prince and Lua is the fool

javascript -

mockserver

Page 70: PHP is the King, nodejs is the Prince and Lua is the fool

Javascript -

github.com/namshi/shisha

shisha smoke tests made easy!

Page 71: PHP is the King, nodejs is the Prince and Lua is the fool

Javascript -

shisha

.smoke file

Page 72: PHP is the King, nodejs is the Prince and Lua is the fool

Javascript -

shisha

Page 73: PHP is the King, nodejs is the Prince and Lua is the fool

redis

Page 74: PHP is the King, nodejs is the Prince and Lua is the fool

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

Page 75: PHP is the King, nodejs is the Prince and Lua is the fool

redis

github.com/nrk/predis

Page 76: PHP is the King, nodejs is the Prince and Lua is the fool

lua

Page 77: PHP is the King, nodejs is the Prince and Lua is the fool

lua

Page 78: PHP is the King, nodejs is the Prince and Lua is the fool

actual architecture

other clients

Page 79: PHP is the King, nodejs is the Prince and Lua is the fool

what’s next?

Page 80: PHP is the King, nodejs is the Prince and Lua is the fool

what’s next?

Page 81: PHP is the King, nodejs is the Prince and Lua is the fool

what’s next?

Page 82: PHP is the King, nodejs is the Prince and Lua is the fool

we love php because

Page 83: PHP is the King, nodejs is the Prince and Lua is the fool

il mondo è bello perché è vario

Page 84: PHP is the King, nodejs is the Prince and Lua is the fool

open your mind…

Page 85: PHP is the King, nodejs is the Prince and Lua is the fool

use the right tool

Page 86: PHP is the King, nodejs is the Prince and Lua is the fool

you can solve problems in different ways

Page 87: PHP is the King, nodejs is the Prince and Lua is the fool

@cirpo

github.com/cirpo

http://joind.in/talk/view/11477

/

Page 88: PHP is the King, nodejs is the Prince and Lua is the fool

thanks

Page 89: PHP is the King, nodejs is the Prince and Lua is the fool

tech.namsi.com/join-us

tech.namshi.com

github.com/namshi

@TechNamshi we are hiring!

Page 90: PHP is the King, nodejs is the Prince and Lua is the fool

tech.namsi.com/join-us

tech.namshi.com

github.com/namshi

@TechNamshi we are hiring!

Page 91: PHP is the King, nodejs is the Prince and Lua is the fool

thanks

Page 92: PHP is the King, nodejs is the Prince and Lua is the fool

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