Language Cloud

international Japan AWS user group



04 December 2013

WHO IS SERGIO ARCOS ?


From Barcelona, Spain



Software Architect @ Languagecloud.co


Researcher
@ NodeSecurity.io


Favorite service: 
http://169.254.169.254/latest/meta-data/
:)

WHAT IS LANGUAGE CLOUD ?

Full suite for English teachers

to increase learning performance easily

  1. Teacher uploads content

  2. Student resolves exercises

  3. Teacher improves methodology  through statistics and metrics

WHY USE AWS ?

  1. Low-latency from anywhere
    1. SaaS business model


  2. Deploy with minimum number of employee
    1. I manage AWS, develop our API, ...


  3. Cannot predict our evolution
    1. High risk associated in a StartUp

      We still don't use any reserved instance!!

1. PAST

HAProxy

PHP (Apache + SSL)

MySQL

NodeJS

DynamoDB

ENVIRONMENTS


Colour green means Small instance, else means Micro instance


EC2: `haproxy`


Development

Production

Opsworks: `PHP` * 2 + `NodeJS`

Demo
EC2: `demo`

HANDICAPS

  1. Fast degradation
    1. MySQL limit connections reached

      PHP max CPU reached


  2. Multiple responsibilities
    1. SSL handled by Apache

      No stateless (local caches)


  3. Database issues
    1. DynamoDB with Pattern Aggregator

      New MySQL table by each organization

2. PRESENT

ELB (SSL)

AngularJS

NodeJS

Redis

MySQL

ENVIRONMENTS


Opsworks: `webpage` + `old_version`


Development

Opsworks: `API (NodeJS)` + `APP (nginx)`

EC2: `DevServices`


Production

Opsworks: `API (NodeJS)` + `APP (nginx)`

EC2: `GraphStats` + `RedisCache` + `TextLogs` + `WorkerStats`

GraphStats

Cookbook "statsd" deployed in API machines

RedisCache

TextLogs

~80% - <10ms

HipChat

(external)

WorkerStats


Machine for asynchronous tasks (batch)

Each module has custom intervals


  • Dashboard (mysql)
  • Analytics (mysql)
  • Webhooks (Mandrill)
  • Patterns (elasticsearch)

Jenkins

(office)

3. FUTURE

Predict bottlenecks

CPU

Just add more machines

(stateless)


1 machine - 1 core - 1 app

(micro or small)

vs

1 machine - N cores - N-1 app

(medium or big)

(Cluster & Domain libraries)

I/O (network bandwidth)


SlaveOf in Redis
(We use 2 connections: Read & Write)

Replication or Sharding in MySQL
(Our ORM allows connect to multiple DBs)

MEMORY


  1. Increase machine vertically

  2. Flush Redis in shorter intervals

  3. Migrate to Riak, Cassandra, ...

  • Change latency by availability

HARD DRIVE


  • Data is allocated in S3 buckets (Infinite storage)
  • MySQL - 75Mb of 5Gb (Max. 3Pb)
  • Backups are moved out AWS

MEASURE

Thanks!

Any questions?



https://slid.es/sergioarcos/


sergio@languagecloud.co

Language Cloud (Use Case in AWS)

By Sergio Arcos

Language Cloud (Use Case in AWS)

  • 2,593