Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to scale ?

How to scale ?

Slides for dotScale 2013 opening talk : How to scale

Quentin ADAM

June 07, 2013
Tweet

More Decks by Quentin ADAM

Other Decks in Technology

Transcript

  1. SO WE NEED TO BE ABLE TO DISPATCH THE WORK

    SCALE OUT •  Many workers doing the same thing •  No SPOF •  Growing is more easy •  Introduce best practice SCALE UP •  1 Fat instance •  1 Fat application •  SPOF (single point of failure) •  Hard to maintain •  Always has a limit •  Short term meaning
  2. CONSIDER MORE THINGS AS DATA •  User account •  Users

    data •  Files •  Sessions •  Events
  3. DATASTORE CHOICES ARE DRIVEN BY USAGE Make decisions based on

    needs Do I need atomicity of requests ? Do I need concurrent access ? Do I mostly read or write ? Do I need relational ? Do I need big storage capacity ? Do I need high availability ?
  4. •  Not a big volume •  DB have to manage

    data TTL •  Data model : K/V •  Multiple writes at the same time •  High availability I need to store sessions QUICK EXAMPLE
  5. •  Not a big volume It’s OK, PG can handle

    small quantity of data •  DB have to manage data TTL No, I have to do it manually •  Data model : K/V No, PG is relational (mainly) •  Multiple writes at the same time No, PG is Atomic •  High availability PG is awesome ;-) Use of PG bouncer or similar allow good clustering I need to store sessions QUICK EXAMPLE
  6. •  Not a big volume It’s OK, redis can handle

    small quantity of data •  DB have to manage data TTL Yes Redis can do it •  Data model : K/V Yes •  Multiple writes at the same time No, redis is pseudo Atomic (master/slave) •  High availability Redis is great, but cauterization is rude… I need to store sessions QUICK EXAMPLE
  7. •  Not a big volume It’s OK, redis can handle

    small quantity of data •  DB have to manage data TTL Yes redis can do it •  Data model : K/V Yes •  Multiple writes at the same time OK, this is possible with memcached protocol •  High availability Clustering is built in, no downtime J I need to store sessions QUICK EXAMPLE
  8. USE ONLINE DATABASE / BE READY TO TEST IN JUST

    A FEW MINUTES NO NEED TO TRASH YOUR COMPUTER
  9. DO NOT USE A TECHNOLOGY BECAUSE YOU <3 IT OR

    BECAUSE IT’S HYPE : USE IT BECAUSE IT FITS YOUR NEEDS BALANCE YOUR LEARNING CURVE WITH THE TIME SAVED
  10. DO NOT USE MEMORY AS DATABASE LIKE : SHARED /

    GLOBAL VARIABLE, CACHE “IN THE CODE”, INTENSIVE SESSION USAGE…
  11. DO NOT USE FILE SYSTEM AS DATASTORE File system are

    POSIX compliant •  POSIX is ACID •  POSIX is powerful but is bottleneck •  File System is nightmare of ops •  File System is create coupling (host provider/OS/language) •  Free SPOF multi tenant File System is a unicorn STORE IN DATABASE, OR DATASTORE LIKE S3 (AWS) DEDICATED TO FILE MANAGEMENT
  12. SPLIT THE CODE : MODULES •  Smallest code base • 

    Deploy as service for each other •  Focus on best technology for a problem
  13. USE EVENT BROKER TO MODULARIZE YOUR APP •  AMQP • 

    Celery •  0MQ •  Redis •  JMS •  Some case : hadoop, akka… •  … CRON is not an event queue