acorncache presentation at boston ruby group

38
vincedevendra @vincedevendra [email protected] m A Customized Approach to HTTP Proxy Caching in Ruby Vince DeVendra

Upload: vince-devendra

Post on 13-Jan-2017

483 views

Category:

Software


1 download

TRANSCRIPT

Page 1: AcornCache Presentation at Boston Ruby Group

vincedevendra@vincedevendra

[email protected]

m

A Customized Approach to HTTP Proxy Caching in Ruby

Vince DeVendra

Page 2: AcornCache Presentation at Boston Ruby Group

An HTTP proxy caching gem for Rack-based Ruby applications

Authors: Vince DeVendra and Perry Carbone

github.com/acorncache/acorn-cache

Page 3: AcornCache Presentation at Boston Ruby Group

The Goals of HTTP Caching

Decrease page load times and the burden on your server

Page 4: AcornCache Presentation at Boston Ruby Group

Two Types of HTTP Caching

Page 5: AcornCache Presentation at Boston Ruby Group

Client (Browser) Caching

Internet

Web Server

Cached data stored here

Page 6: AcornCache Presentation at Boston Ruby Group

Proxy Caching

Internet

Application Server

Cached data stored here

Proxy Cache Server

Page 7: AcornCache Presentation at Boston Ruby Group

Where Does AcornCache Fit In?

Internet

Page 8: AcornCache Presentation at Boston Ruby Group

Middleware Stack ExampleIncoming Request AcornCach

e

Middleware 2

Middleware 3..n

Application

Server ResponseReques

t

Outgoing Cached Response

Page 9: AcornCache Presentation at Boston Ruby Group

Middleware Stack ExampleIncoming Request AcornCach

e

Middleware 2

Middleware 3..n

Application

Outgoing Server Response

Server ResponseReques

t

Page 10: AcornCache Presentation at Boston Ruby Group

Why Did We Build It?

+

=

Page 11: AcornCache Presentation at Boston Ruby Group

Does it Work?

Page 12: AcornCache Presentation at Boston Ruby Group

Does it Work?

Page 13: AcornCache Presentation at Boston Ruby Group

Does it Work?

Complexity

Request Time

With Acorn Cache

Without AcornCache

Page 14: AcornCache Presentation at Boston Ruby Group

Getting Started

CACHE ALL THE THINGS!

Page 15: AcornCache Presentation at Boston Ruby Group

What to Cache With?

Page 16: AcornCache Presentation at Boston Ruby Group
Page 17: AcornCache Presentation at Boston Ruby Group

Rack::AcornCache

Cached Response

Server Response Request

Initial Object Model

Page 18: AcornCache Presentation at Boston Ruby Group

Respecting Cache Control Headers

This should be easy, right?

Page 19: AcornCache Presentation at Boston Ruby Group
Page 20: AcornCache Presentation at Boston Ruby Group

Pondering the Ethical Implications

of RFC Protocols

Page 21: AcornCache Presentation at Boston Ruby Group
Page 22: AcornCache Presentation at Boston Ruby Group
Page 23: AcornCache Presentation at Boston Ruby Group
Page 24: AcornCache Presentation at Boston Ruby Group

Rack::AcornCache

Expanded Object Model

Cache Controller

Cache Maintenance

Cached Response

Cache Control Header

Server Response

Cache Control Header

RequestCache Control Header

Page 25: AcornCache Presentation at Boston Ruby Group
Page 26: AcornCache Presentation at Boston Ruby Group
Page 27: AcornCache Presentation at Boston Ruby Group

Thinking About Thread Safety

Page 28: AcornCache Presentation at Boston Ruby Group

Exception Handling

Because SometimesThere Are Unforeseen

Complications

Page 29: AcornCache Presentation at Boston Ruby Group

Exception Handling

Page 30: AcornCache Presentation at Boston Ruby Group

Allowing for Customization

Implement Page Rules

Page 31: AcornCache Presentation at Boston Ruby Group
Page 32: AcornCache Presentation at Boston Ruby Group

Pure Ruby FTW

Page 33: AcornCache Presentation at Boston Ruby Group

Isn’t This All Against the Rules?

Page 34: AcornCache Presentation at Boston Ruby Group
Page 35: AcornCache Presentation at Boston Ruby Group
Page 36: AcornCache Presentation at Boston Ruby Group

Future Plans

Page 37: AcornCache Presentation at Boston Ruby Group

An HTTP proxy caching gem for Rack-based Ruby applications

github.com/acorncache/acorn-cache

Please Contribute!

Page 38: AcornCache Presentation at Boston Ruby Group

vincedevendra@vincedevendra

[email protected]

Vince DeVendra

Looking for Work!