The Wizardry of Scaling Ayende Rahien / Oren Eini - - PowerPoint PPT Presentation

the wizardry of scaling
SMART_READER_LITE
LIVE PREVIEW

The Wizardry of Scaling Ayende Rahien / Oren Eini - - PowerPoint PPT Presentation

The Wizardry of Scaling Ayende Rahien / Oren Eini http://ayende.com/Blog ayende@ayende.com Scaling A service is said to be scalable if when we increase the resources in a system, it results in increased performance in a manner proportional


slide-1
SLIDE 1

The Wizardry of Scaling

Ayende Rahien / Oren Eini http://ayende.com/Blog ayende@ayende.com

slide-2
SLIDE 2

Scaling

A service is said to be scalable if when we increase the resources in a system, it results in increased performance in a manner proportional to resources added proportional to resources added

Werner Vogels CTO - Amazon.com

slide-3
SLIDE 3

Scaling

  • # of requests
  • Data size
  • Complexity
slide-4
SLIDE 4

Scenario

slide-5
SLIDE 5

Attempt #1

slide-6
SLIDE 6

More Users Get Bigger Server Users Server

slide-7
SLIDE 7

More auth requests Get Bigger Servers requests Servers

slide-8
SLIDE 8

Requirements

  • Lock accounts
  • Personalization
  • Auditing
slide-9
SLIDE 9

End Result

More requests More users

???

More requirements

slide-10
SLIDE 10

Micro optimization as a way of life

slide-11
SLIDE 11

Traditional Architecture

slide-12
SLIDE 12

A single source of truth?

Audit OLTP Login

slide-13
SLIDE 13

CAP

  • Consistency
  • Availability
  • Partition Tolerance

Pick any two

slide-14
SLIDE 14

CAP

theorem

  • cap
  • http://www.julianbrowne.com/article/viewer/brewers
slide-15
SLIDE 15

How to scale my app?

slide-16
SLIDE 16

Divide and Conquer

slide-17
SLIDE 17

Operations

  • Authenticate User
  • Audit all logins
  • Create User
  • Personalization information
  • Personalization information
slide-18
SLIDE 18

Solve just a single problem

For N number of users, answer if user/pass combo is valid in constant time is valid in constant time

Data Structures 101

slide-19
SLIDE 19

Code

slide-20
SLIDE 20

In memory / single machine

  • Single user memory usage – 56 bytes:

– 16 chars / 32 bytes – username – 24 bytes – hashed password

  • 1,000,000 users = 53.4 Mb!
  • 1,000,000 users = 53.4 Mb!
  • 10,000,000 users = 534 Mb!
  • 100,000,000 users = 5.34 Gb!
slide-21
SLIDE 21

Scaling higher…

A - C D - F G - I J - L M - O P - R S - U V - Z

slide-22
SLIDE 22

Operations

  • Authenticate User
  • Audit all logins
  • Create User
  • Personalization information
  • Personalization information
slide-23
SLIDE 23

Audits

Record information about login attempts results

Rarely Read Huge amounts of data

slide-24
SLIDE 24

System.IO.File

slide-25
SLIDE 25

Operations

  • Authenticate User
  • Audit all logins
  • Create User
  • Personalization information
  • Personalization information
slide-26
SLIDE 26

Create User

  • Email cycle
  • Register in system:

– Personalization – Login – Login – Etc…

slide-27
SLIDE 27

Code

slide-28
SLIDE 28

A system of idiot savants

slide-29
SLIDE 29

Tailoring the solution

  • When breaking a system to independent

components…

– 3 tiers doesn’t make sense – Sharing among components is discouraged – Sharing among components is discouraged – Find the best solution for the problem at hand, vs. generic solutions.

slide-30
SLIDE 30

In .NET – Service Buses

slide-31
SLIDE 31

In .NET – Non SQL DBs

slide-32
SLIDE 32

Summary

  • Divide and conquer
  • Single task operations
  • Optimize for each task
  • There is no one infrastructure fits every task
  • There is no one infrastructure fits every task
slide-33
SLIDE 33

Questions?