Your language doesn't scale

60
Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin Ikai Lan — Your Language Doesn’t Scale Slide 1 Your Language Doesn't Scale A Discussion of the Nature of Scaling Ikai Lan Linkedin

description

Another set of slides for Colorado Software Summit 2008. Again, I never ended up giving this talk because I had to ship product.

Transcript of Your language doesn't scale

Page 1: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 1

Your Language Doesn't ScaleA Discussion of the Nature of Scaling

Ikai Lan

Linkedin

Page 2: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 2

Hi! I’m Ikai Lan

Page 3: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 3

This talk is about scaling

Page 4: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 4

Particularly with regards to theweb

Page 5: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 5

Attributes of a web app

Client pull based

Operations must finish “fast”

“Fresh” information

Page 6: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 6

The chip on my shoulder

Page 7: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 7

Ruby on Rails can’t scale!

Ruby is slow

Default SQL used is not optimal

Page rendering is slow

Page 8: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 8

All of these are true

Page 9: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 9

1. Ruby is slow

Page 10: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 10

2. SQL used is not optimal

Page 11: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 11

3. Rendering is slow

I don’t have a clever picture here.

Just take my word for it.

Page 12: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 12

Why do these fall flat?

Page 13: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 13

Scaling != efficiency

Page 14: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 14

Efficiency is

Minimizing input foroutput

Bang for your buck

Page 15: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 15

Scaling != performance

Page 16: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 16

Performance is

Maximizing outputfor some input

Speed

Page 17: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 17

Scalability is

Being able to growcapacity withdemand

How well a solutionto some problemwill work when thesize of the problemincreases

Page 18: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 18

In an ideal world …

We achieve scalability

efficiently while maintaining

performance

Page 19: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 19

Myth: Needing to throwhardware to solve acapacity problem meansyour application is notscalable

Page 20: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 20

Truth: If this works, bythe definition, yourapplication IS scalable

Page 21: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 21

… maybe not efficient

Page 22: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 22

So the arguments …

Ruby is slow

Default SQL is notoptimal

Page rendering isslow

Page 23: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 23

Internet

User

Concerning performance …

BrowserDatabase

Assets

Page 24: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 24

Internet

User

How much time?

Rendering: LONG TIMELONG TIME

Assets

Tiny fraction

Network: ???

Page 25: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 25

Scaling case study

Page 26: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 26

First let’s define terms

Page 27: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 27

Vertical scaling

Improvingperformance in oneof our componenttiers

Adding a tieroptimized for someportion of the load

Page 28: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 28

Vertical scaling examples

Upgrading hardware

Edge caching

Adding a caching tier for the data store

Page 29: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 29

Horizontal scaling

Increase capacity byincreasing instancesof components

Spreading loadacross instances

Page 30: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 30

Horizontal scaling examples

Load balancing (hardware LB or DNSload balancing)

Data partitioning

Page 31: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 31

Different strokes …

Page 32: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 32

On to the case study!

Page 33: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 33

These guys made a site

Matt Ikai

Page 34: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 34

To share pictures!

Page 35: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 35

Our first architecture

Page 36: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 36

Awesome! We have users!

Page 37: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 37

We have too many users!

Page 38: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 38

Dude! Add more

hardware!

You don’t think I tried?

The hardware - it does

nothing!

The yelling begins

Page 39: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 39

Our current architecture

Page 40: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 40

Why isn’t this working?

Page 41: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 41

Bottlenecks! Bottlenecks!

Page 42: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 42

The first bottleneck is always thepersistent store

Page 43: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 43

Solution: Replicate data

Page 44: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 44

New problem: replication delay

How come everything I do

takes a few minutes to work?

Page 45: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 45

Solution: caching

Page 46: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 46

New problem: stale data

I can’t remove this tag!

Sometimes things aren’t up

to date!

Page 47: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 47

So now we’ve spent all thatengineering effort and addedno new functionality

(would have been a lot harder if wewere also trying to add features tostay competitive)

Page 48: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 48

Are we done? Maybe …

Page 49: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 49

More growth: allpersistence operations areexpensive

Page 50: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 50

Have to partition DB

Page 51: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 51

Our application has to nowunderstand how to speakto a partitioned store

Page 52: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 52

This is really hard!

Page 53: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 53

And I haven’t even gottento transactional integrityor backups

Page 54: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 54

We’re also introducingmany more points offailure = ops burden

Page 55: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 55

Engineering problems

Cross functional development

Merging

Regression testing

Page 56: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 56

Things now cost too much!

Page 57: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 57

Do we even have a businessmodel?

Page 58: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 58

No one is spared!

Page 59: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 59

Questions?

Page 60: Your language doesn't scale

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Linkedin

Ikai Lan — Your Language Doesn’t Scale Slide 60

Thanks for coming!

[email protected]

http://www.linkedin.com/in/ikailan