54
PHP in the Enterprise Stories from the Front Line Paul Reinheimer Wednesday, March 10, 2010

PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

PHP in the EnterpriseStories from the Front LinePaul Reinheimer

Wednesday, March 10, 2010

Page 2: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Paul Reinheimer @[email protected]

http://preinheimer.comhttp://wonderproxy.com

Wednesday, March 10, 2010

Page 3: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Mansef Group

Wednesday, March 10, 2010

Page 4: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

"Enterprise" Stats

70 Million Uniques/Day

Four Major Properties from "tube" sites to dating

Wednesday, March 10, 2010

Page 5: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Topics

Memcached

Sphinx

GeoIP

Gomez vs Other

Frontend Performance

HipHop

MySQL

Circonus

Mobile Content Protection

Wednesday, March 10, 2010

Page 6: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Using PHP

Wednesday, March 10, 2010

Page 7: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Wednesday, March 10, 2010

Page 8: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Wednesday, March 10, 2010

Page 9: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Memcached

Data Federation

Slabs, stores, promises

Serializer

Wednesday, March 10, 2010

Page 10: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Promises

Wednesday, March 10, 2010

Page 11: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Promises

memcached doesn't lie, it just doesn't make promises

Wednesday, March 10, 2010

Page 12: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Promises

it makes a promise

Wednesday, March 10, 2010

Page 13: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Promises

data will no longer be available after it expires

Wednesday, March 10, 2010

Page 14: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Promises

When memcached doesn't have the information you need, get it elsewhere.

Use a read-through caching callback or put it in your caching object.

memcached is allowed to lose data!

Wednesday, March 10, 2010

Page 15: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Wednesday, March 10, 2010

Page 16: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Wednesday, March 10, 2010

Page 17: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

48

60

75

96

120

150

187

234

292

366

460

0 25 50 75 100

Wednesday, March 10, 2010

Page 18: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

48

60

75

96

120

150

187

234

292

366

460

0 25 50 75 100

Wednesday, March 10, 2010

Page 19: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Sphinx

There's another talk, it's good

Wednesday, March 10, 2010

Page 20: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

GeoIP

Big Deal for us

Price selection

Billing Cascades

Internal and External systems

QA Nightmare

Wednesday, March 10, 2010

Page 21: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Challenge

Aid appropriate teams to make dealing with GeoIP as trivial as possible without

affecting workflow

Wednesday, March 10, 2010

Page 22: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Problem - Proxies Suck

Slow

Buy Now

Wednesday, March 10, 2010

Page 23: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Problem - Web Proxies Suck

Wednesday, March 10, 2010

Page 24: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Solution

Find a real Proxy Service

Wednesday, March 10, 2010

Page 25: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Solution

Create a real Proxy Service

Wednesday, March 10, 2010

Page 26: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Gomez vs Other?

Download performance from clients

Use google for real client data

Find bottlenecks

Wednesday, March 10, 2010

Page 27: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Methodology

Generate an exact 10KB file

Place it on all PH web servers

Place it on the CDN

Place it on all media servers (NY and NL)

Write a test script to runs on 0.1% of requests

Report the time it takes to load that image (in ms) from each server

Wednesday, March 10, 2010

Page 28: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Redacted

Wednesday, March 10, 2010

Page 29: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Wednesday, March 10, 2010

Page 30: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Wednesday, March 10, 2010

Page 31: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Frontend Performance

YSlow

Website Optimizer

CSS Sprites

Request Minimization & Compression

Wednesday, March 10, 2010

Page 32: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Mandate

Increase sales

Decreasing page load time

Don't interfere with current work flow

Leave infrastructure behind for trivial future use

Wednesday, March 10, 2010

Page 33: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Read

Wednesday, March 10, 2010

Page 34: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Read Moar

Wednesday, March 10, 2010

Page 35: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Stats

Wednesday, March 10, 2010

Page 36: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Stats

Wednesday, March 10, 2010

Page 37: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Stats

47 48 49 50 51 52 1

Normal Optimized

10-20% Increase in Sales

40% Decrease in Bounce Rate

Wednesday, March 10, 2010

Page 38: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Wednesday, March 10, 2010

Page 39: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

HipHop for PHP

Twice as fast

Not yet using it in production

Wednesday, March 10, 2010

Page 40: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

MySQL

Wednesday, March 10, 2010

Page 41: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Data Federation

Wednesday, March 10, 2010

Page 42: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Data Federation - Functional Partitions

Users Website

Content

Wednesday, March 10, 2010

Page 43: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Data Federation - Functional Partitions

Users Website

Content

Wednesday, March 10, 2010

Page 44: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Circonus

Systems Monitoring Demo

Wednesday, March 10, 2010

Page 45: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Mobile Content Protection

Wednesday, March 10, 2010

Page 46: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Challenge

$key = magicSauce($ip);

Wednesday, March 10, 2010

Page 47: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Problem

Wednesday, March 10, 2010

Page 48: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Problem

Wednesday, March 10, 2010

Page 49: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Problem

Wednesday, March 10, 2010

Page 50: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Problem

Wednesday, March 10, 2010

Page 51: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Problem

Wednesday, March 10, 2010

Page 52: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Solution

$session['ip'] = $_SERVER['REMOTE_ADDR'];

Wednesday, March 10, 2010

Page 53: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

if($SERVER['REMOTE_ADDR']) != $session['ip']){ $key = magicSauce(FALSE);}else{

$session['ip'] = $_SERVER['REMOTE_ADDR'];

}

Wednesday, March 10, 2010

Page 54: PHP in the Enterpriseblog.preinheimer.com/talks/PHP in the Enterprise... · Gomez vs Other Frontend Performance HipHop MySQL Circonus Mobile Content Protection Wednesday, March 10,

Thank You

We're Hiring!

Intermediate & Senior front end integrators

Intermediate & Senior back end (PHP) developers

Wednesday, March 10, 2010