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

Post on 22-Nov-2014

1.978 Views

Category:

Internet

0 Downloads

Preview:

Click to see full reader

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

TRANSCRIPT

PHP is the king,

nodejs is the prince, Lua is the fool

@cirpo

dubai

dubai

namshi

namshi

Namshi

almost 3 years old

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

– M.Fowler

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

independently deployable services…” !

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

publish consume

q u e u e

RabbitMQ

github.com/videlalvaro/php-amqplib

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 - Silex

Let’s eat those apis!

Javascript

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

Javascript

Javascript

Javascript

Javascript

party time!

from stateful to stateless

Removed server sessions Sessions on the client (localstorage)

Stateless

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

PHP - JWS

github.com/namshi/jose

JOSÉ

PHP - JWS

PHP - JWS

double party time!

let’s do the same with 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 -

github.com/namshi/mockserver

mockserver mock your APIs in a matter of seconds!

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 clients

what’s next?

what’s next?

what’s next?

we love php because

il mondo è bello perché è vario

open your mind…

use the right tool

you can solve problems in different ways

@cirpo

github.com/cirpo

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

/

thanks

tech.namsi.com/join-us

tech.namshi.com

github.com/namshi

@TechNamshi we are hiring!

tech.namsi.com/join-us

tech.namshi.com

github.com/namshi

@TechNamshi we are hiring!

thanks

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

top related