a customized approach to http proxy caching in ruby

36
Perry Carbone Github: github.com/perrycarbone Twitter: @perrycarbone A Customized Approach to HTTP Proxy Caching in Ruby

Upload: perry-carbone

Post on 13-Jan-2017

241 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: A Customized Approach to HTTP Proxy Caching in Ruby

Perry Carbone

Github: github.com/perrycarboneTwitter: @perrycarbone

A Customized Approach to HTTP Proxy Caching in Ruby

Page 2: A Customized Approach to HTTP Proxy Caching in Ruby

An HTTP proxy caching gem for Rack-based Ruby applications

https://github.com/acorncache/acorn-cache

Co-Authors: Perry Carbone; Vince Devendra

Page 3: A Customized Approach to HTTP Proxy Caching in Ruby

The Goals of HTTP Caching

Decrease page load times and the burden on your server

Page 4: A Customized Approach to HTTP Proxy Caching in Ruby

Two Types of HTTP Caching

Page 5: A Customized Approach to HTTP Proxy Caching in Ruby

Client (Browser) Caching

Internet

Web Server

Cached data stored here

Page 6: A Customized Approach to HTTP Proxy Caching in Ruby

Proxy Caching

Internet

Application Server

Cached data stored here

Proxy Cache Server

Page 7: A Customized Approach to HTTP Proxy Caching in Ruby

Where Does AcornCache Fit In?

Internet

Client Client Client

Page 8: A Customized Approach to HTTP Proxy Caching in Ruby

Middleware Stack ExampleIncoming Request

AcornCache

Middleware 2

Middleware 3..n

Application

Outgoing Cached Response

Server Response

Request

Page 9: A Customized Approach to HTTP Proxy Caching in Ruby

Middleware Stack ExampleIncoming Request

AcornCache

Middleware 2

Middleware 3..n

Application

Outgoing Server Response

Server Response

Request

Page 10: A Customized Approach to HTTP Proxy Caching in Ruby

Why Did We Build It?

+

=

Page 11: A Customized Approach to HTTP Proxy Caching in Ruby

Does it Work?

Page 12: A Customized Approach to HTTP Proxy Caching in Ruby

Does it Work?

Page 13: A Customized Approach to HTTP Proxy Caching in Ruby

Does it Work?

Complexity

Request Time

With Acorn Cache

Without AcornCache

Page 14: A Customized Approach to HTTP Proxy Caching in Ruby

Getting Started

CACHE ALL THE THINGS!

Page 15: A Customized Approach to HTTP Proxy Caching in Ruby

What to Cache With?

Page 16: A Customized Approach to HTTP Proxy Caching in Ruby
Page 17: A Customized Approach to HTTP Proxy Caching in Ruby

Rack::AcornCache

Cached Response

Server Response Request

Initial Object Model

Page 18: A Customized Approach to HTTP Proxy Caching in Ruby

Respecting Cache Control Headers

This should be easy, right?

Page 19: A Customized Approach to HTTP Proxy Caching in Ruby
Page 20: A Customized Approach to HTTP Proxy Caching in Ruby
Page 21: A Customized Approach to HTTP Proxy Caching in Ruby
Page 22: A Customized Approach to HTTP Proxy Caching in Ruby
Page 23: A Customized Approach to HTTP Proxy Caching in Ruby

Rack::AcornCache

Expanded Object Model

Cache Controller

Cache Maintenance

Cached Response

Cache Control Header

Server Response

Cache Control Header

RequestCache Control

Header

Page 24: A Customized Approach to HTTP Proxy Caching in Ruby
Page 25: A Customized Approach to HTTP Proxy Caching in Ruby
Page 26: A Customized Approach to HTTP Proxy Caching in Ruby

Thinking About Thread Safety

Page 27: A Customized Approach to HTTP Proxy Caching in Ruby

Exception Handling

Because SometimesThere Are Unforeseen

Complications

Page 28: A Customized Approach to HTTP Proxy Caching in Ruby

Exception Handling

Page 29: A Customized Approach to HTTP Proxy Caching in Ruby

Allowing for Customization

Implement Page Rules

Page 30: A Customized Approach to HTTP Proxy Caching in Ruby
Page 31: A Customized Approach to HTTP Proxy Caching in Ruby

Pure Ruby FTW

Page 32: A Customized Approach to HTTP Proxy Caching in Ruby
Page 33: A Customized Approach to HTTP Proxy Caching in Ruby
Page 34: A Customized Approach to HTTP Proxy Caching in Ruby

Future Plans

Page 35: A Customized Approach to HTTP Proxy Caching in Ruby

An HTTP proxy caching gem for Rack-based Ruby applications

https://github.com/acorncache/acorn-cache

Please Contribute!

Page 36: A Customized Approach to HTTP Proxy Caching in Ruby

Perry Carbone

Github: github.com/perrycarboneTwitter: @perrycarbone

Email: [email protected]

Looking for Work!