Download - MEAN Stack

Transcript
Page 1: MEAN Stack

by Samiyuru Senarathne

Mean StackFast scalable web apps

Friday, July 25, 14

Page 2: MEAN Stack

Who am I?

I am Samiyuru Senarathne

javascript, Objective C and java background

Web development experience in node, php, python and java

Friday, July 25, 14

Page 3: MEAN Stack

What is Mean Stack?

Friday, July 25, 14

Page 4: MEAN Stack

Mean Stack is!

A modern web development technology stack

express

Friday, July 25, 14

Page 5: MEAN Stack

Why Mean Stack?

Friday, July 25, 14

Page 6: MEAN Stack

Isn't it good to use one language everywhere

Reuse code in client and server

Scalability

Advantages & Why?

And we hope we’ll get to develop in this stack in the future

Friday, July 25, 14

Page 7: MEAN Stack

JS everywhere

Isn't it too slowww....?

Friday, July 25, 14

Page 8: MEAN Stack

Node vs ApacheConcurrency  Level:            20000Time  taken  for  tests:      1043.076  secondsComplete  requests:            1000000Failed  requests:                25227      (Connect:  0,  Receive:  8409,  Length:  8409,  Exceptions:  8409)Write  errors:                      0Total  transferred:            81265680  bytesHTML  transferred:              18059040  bytesRequests  per  second:        958.70  [#/sec]  (mean)Time  per  request:              20861.529  [ms]  (mean)Time  per  request:              1.043  [ms]  (mean,  across  all  concurrent  requests)Transfer  rate:                    76.08  [Kbytes/sec]  received  Connection  Times  (ms)                            min    mean[+/-­‐sd]  median      maxConnect:                0  10201  2391.8    10840      20177Processing:      595  10455  3239.1    10904      39809Waiting:                0  8323  2331.0      8728      38740Total:              1181  20656  4758.5    21795      44333

Concurrency  Level:            20000Time  taken  for  tests:      3570.753  secondsComplete  requests:            1000000Failed  requests:                2617614      (Connect:  0,  Receive:  848121,  Length:  886497,  Exceptions:  882996)Write  errors:                      0Total  transferred:            36832520  bytesHTML  transferred:              2372264  bytesRequests  per  second:        280.05  [#/sec]  (mean)Time  per  request:              71415.058  [ms]  (mean)Time  per  request:              3.571  [ms]  (mean,  across  all  concurrent  requests)Transfer  rate:                    10.07  [Kbytes/sec]  received  Connection  Times  (ms)                            min    mean[+/-­‐sd]  median      maxConnect:                0  4259  14734.0            0      79497Processing:          4  64979  51442.2    65543    381910Waiting:                0  2725  16784.2            0    249108Total:                  87  69238  56233.8    68138    426365

Friday, July 25, 14

Page 9: MEAN Stack

Who uses Mean Stack

Friday, July 25, 14

Page 10: MEAN Stack

Let’s jump to work

Friday, July 25, 14

Page 11: MEAN Stack

Wait!

Let’s see what we are gonna use!

Friday, July 25, 14

Page 12: MEAN Stack

We’ll create an app module

Will be using controllers

We’ll use angular $http service

Directivesng-app, ng-controller, ng-model, ng-click, ng-keypress, ng-repeat, ng-class, ng-if

Friday, July 25, 14

Page 13: MEAN Stack

MongoDB is our database

Start mongodb in terminal

querying the db from mongo shell

Insertion & finding documents from collections

Friday, July 25, 14

Page 14: MEAN Stack

Node is a platform built on Chrome's JavaScript runtime

Node uses an event-driven, non-blocking I/O model

Friday, July 25, 14

Page 15: MEAN Stack

Create express app

map static files

get & post routes

respond to client in json

express

Friday, July 25, 14

Page 16: MEAN Stack

Now let’s jump to work

Friday, July 25, 14

Page 17: MEAN Stack

Scalability

Are you ready to scale?

Friday, July 25, 14

Page 18: MEAN Stack

Vertical Scaling

Friday, July 25, 14

Page 19: MEAN Stack

Horizontal Scaling

Friday, July 25, 14

Page 20: MEAN Stack

No bottle necks

Mongo Node

Friday, July 25, 14

Page 21: MEAN Stack

Scale Node

Node enforce shared nothing architecture

Process clustering

Friday, July 25, 14

Page 22: MEAN Stack

Scale MongoDb

Friday, July 25, 14

Page 23: MEAN Stack

Thank You

Friday, July 25, 14