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

Post on 20-Aug-2015

3.060 Views

Category:

Internet

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Alessandro Cinelli (cirpo)

PHP is the king,

nodejs is the prince,

Lua is the fool

dubai

dubai

namshi

dubai

Namshi

almost 3 years old

~250 ppl

IT team ~15 ppl

million+ visits per month

serving the UAE and GCC

PHP

Architecture

a monolithic architecture

so far so good… but we started growing…

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

SOA

Service Oriented Architecture

– 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_)

– 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!

services as Lego bricks

Unix Philosophy

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

SOA Benefits

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

how do you connect services?

HTTP

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

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

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

- Gandalf

Rabbitmq

using crons!

Rabbitmq

Rabbitmq

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!

PHP

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

PHP

bundle -> app -> service

PHP

UserBundle

WarehouseBundle

CheckoutBundle

ProductBundle

[…]

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

PHP

silex

the PHP micro-framework based on Symfony2 components

PHP

Let’s eat those apis!

Javascript

Javascript

Two way data-binding Single page application

Built-in services on top of XHR Routing

Controller Model

Javascript

it’s a MVW framework:

Model-View-Whatever

Javascript

Javascript

Javascript

Javascript

party time!

from statefull to stateless

Removed server sessions Sessions on the client (localstorage)

stateless

JSON Web Signature

http://tools.ietf.org/html/draft-jones-json-web-signature-04

PHP - JWS

github.com/namshi/jose

JOSÉ

PHP - JWS

PHP - JWS

double party time!

lets do the same for the desktop website…

some customers were experiencing some issues…

Javascript

Javascript

Javascript

we rebuilt the desktop website in two weeks!

Javascript

Rapid application development Quick setup Event driven Javascript!

why node?

Javascript

mockserver mock your APIs

in a matter of seconds!

github.com/namshi/mockserver

Javascript

mockserver

Javascript users_GET.mock file

mockserver

Javascript

mockserver

Javascript

github.com/namshi/shisha

shisha smoke tests made easy!

Javascript

shisha

.smoke file

Javascript

shisha

redis

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

redis

github.com/nrk/predis

lua

lua

actual architecture

other

RabbitMq

publish consumeq u

WHAT’S NEXT?

WHAT’S NEXT?

WHAT’S NEXT?

we love php because

il mondo è bello perché è vario

The world is beautiful because it is varied

il mondo è bello perché è vario

il mondo è bello perché è vario

The world is beautiful because it is varied

be open

il mondo è bello perché è vario

The world is beautiful because it is varied

use the right tool

il mondo è bello perché è vario

The world is beautiful because it is varied

you can solve problems in different ways

That’s all folks

@cirpo

github.com/cirpo

/

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

github.com/namshi

twitter.com/TechNamshi

tech.namshi.com

THANKS

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/

top related