php is the king, nodejs is the prince and lua is the fool

93
Alessandro Cinelli (cirpo) PHP is the king , nodejs is the prince , Lua is the fool

Upload: alessandro-cinelli

Post on 20-Aug-2015

3.060 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: PHP is the king, nodejs is the prince and Lua is the fool

Alessandro Cinelli (cirpo)

PHP is the king,

nodejs is the prince,

Lua is the fool

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

dubai

Page 8: PHP is the king, nodejs is the prince and Lua is the fool

Namshi

almost 3 years old

~250 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”

– A.Nadalin (@_odino_)– A.Nadalin (@_odino_)

Page 23: PHP is the king, nodejs is the prince and Lua is the fool

– A.Nadalin (@_odino_)– A.Nadalin (@_odino_)

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

as suites of independently deployable services…”

– M.Fowler

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

Page 35: PHP is the king, nodejs is the prince and Lua is the fool

Rabbitmq

Page 36: 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 37: PHP is the king, nodejs is the prince and Lua is the fool

PHP

Page 38: 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 39: PHP is the king, nodejs is the prince and Lua is the fool

PHP

bundle -> app -> service

Page 40: PHP is the king, nodejs is the prince and Lua is the fool

PHP

UserBundle

WarehouseBundle

CheckoutBundle

ProductBundle

[…]

Page 41: 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 42: PHP is the king, nodejs is the prince and Lua is the fool

PHP

silex

the PHP micro-framework based on Symfony2 components

Page 43: PHP is the king, nodejs is the prince and Lua is the fool

PHP

Page 44: PHP is the king, nodejs is the prince and Lua is the fool

Let’s eat those apis!

Page 45: PHP is the king, nodejs is the prince and Lua is the fool

Javascript

Page 46: PHP is the king, nodejs is the prince and Lua is the fool

Javascript

Two way data-binding Single page application

Built-in services on top of XHR Routing

Controller Model

Page 47: PHP is the king, nodejs is the prince and Lua is the fool

Javascript

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 statefull 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 Signature

http://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

lets do the same for 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

mockserver mock your APIs

in a matter of seconds!

github.com/namshi/mockserver

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

Page 79: PHP is the king, nodejs is the prince and Lua is the fool

RabbitMq

publish consumeq u

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

WHAT’S NEXT?

Page 83: PHP is the king, nodejs is the prince and Lua is the fool

we love php because

Page 84: PHP is the king, nodejs is the prince and Lua is the fool

il mondo è bello perché è vario

The world is beautiful because it is varied

il mondo è bello perché è vario

Page 85: PHP is the king, nodejs is the prince and Lua is the fool

il mondo è bello perché è vario

The world is beautiful because it is varied

be open

Page 86: PHP is the king, nodejs is the prince and Lua is the fool

il mondo è bello perché è vario

The world is beautiful because it is varied

use the right tool

Page 87: PHP is the king, nodejs is the prince and Lua is the fool

il mondo è bello perché è vario

The world is beautiful because it is varied

you can solve problems in different ways

Page 88: PHP is the king, nodejs is the prince and Lua is the fool

That’s all folks

Page 89: PHP is the king, nodejs is the prince and Lua is the fool

@cirpo

github.com/cirpo

/

Page 90: PHP is the king, nodejs is the prince and Lua is the fool

we are hiring!tech.namshi.com/join-us

github.com/namshi

twitter.com/TechNamshi

tech.namshi.com

Page 91: PHP is the king, nodejs is the prince and Lua is the fool
Page 92: PHP is the king, nodejs is the prince and Lua is the fool

THANKS

Page 93: PHP is the king, nodejs is the prince and Lua is the fool

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/