a rest protocol for horizontally scalable cloud database access

1
Amazon EC2 Ireland Benchmark Instance Web- Fronted Benchmark Instance Web- Fronted ... OS: Windows Server Size: 1 core, 1 GB RAM 50 parallel instances Benchmark Instance Web- Fronted Launched simultaneously I I I I n n t t t e r r n n n n e e e e e t t t t Internet Squid Web Cache OS: Linux Size: 2 cores, 7.5 GB RAM Orestes Versant Object Database OS: Windows Server Size: 2 cores, 7.5 GB RAM Launcher 165ms Amazon EC2 California Orestes: a REST protocol for horizontally scalable cloud database access Observations Reduction of server load Low latency I I I I I I I n n n n t t t t t e e e e e e r r r r n n n n n n n n e e e e e e e e e t t t t t t t t t t t Internet Orestes Cache Arriving requests Requests reaching the server I I I I I I n n n t t t t t t e e e e e e r r r r n n n n n n n n n e e e e e e e t t t t t t t t t t t t Internet Orestes Cache Low latency High latency Orestes Arbitrary combinations of persistence API and DB Reads scale horizontally JavaScript JPA Orestes Open protocol Orestes HTTP and JSON VOD Java JDO Orestes Orestes db4o Different database systems Different programming languages / APIs I I I I I I I n n n t t t t t t e e e e e e r r r r r n n n n n n n n e e e e e e e e t t t t t t t t t t t t Internet Orestes Load- Balancer Arriving requests Scale-out B Cache Cache Cache Cache writes changes Reads don't reach the server P P P P P P P P P a a a a a a a a a a a a a a a a a a S S S S S S S S S S C C C C C l l l o o o o o o o u u u u u u u d d d d d d d d d d d d d PaaS Cloud C C C C C C l l l l l l o o o o o u u u u u u u u d d d d d d d d d d d d Cloud Orestes as a Service O Orestes Application Orestes Application deployed in cloud On premise application Firewalls, proxys, load-balancers A A A A A A A A A A A Cloud and service capable DB interface Browser persistence and administration I I I I I I I I n n n n t t t t t t e e e e e e r r r r n n n n n n n n e e e e e e e e e t t t t t t t t t t t t Internet Orestes Remote database Browser Accounts, data analysis, monitoring... Direct database access from client side s Solution Open problems: Database as a service, cloud computing network latency Web-scale applications, commodity hardware scalability issues Goal: Scalable, cloud capable database systems Our approach: ORESTES (Objects RESTfully encapsulated in standard formats) Property Mechanism Read scalability Web caching of database objects Low latency Cache deployment in client network Loose coupling of persistence API and DB Generic HTTP access protocol and resource structure Standard formats Extensible HTTP content negotiation + default JSON formats Felix Gessert, Florian Bücklers, Norbert Ritter University of Hamburg Illustration of the Key Properties System Overview Caching mechanism: HTTP caching with statically assigned object lifetimes Server Persistence API Orestes Interface RESTful HTTP Orestes Protocol Database Interface Orestes Client D b P e r s i s t e n c e Client Orestes Server Orestes Interface Application Database Scales horizontally Orestes layer Visit us at the URL http://orestes.info or contact us via email: [email protected] Orestes server (America) caches (Hamburg) benchmark client (Hamburg) 1 2 3 1 2 3 Orestes without cache VOD native Orestes with cache Orestes O I I I I I I I I I I I n n n n n n n n n n n t t t t t t t t t e e e e e e e e e e e e e e r r r r r r r r r r r n n n n n n n n n n n n n n n e e e e e e e e e e e e e e e e e e e e t t t t t t t t t t t Internet L L 2 - J D O C a a a c h e L2-JDO Cache Different forward proxy caches Round-trip time 180ms ± 5ms Compared benchmark setups Squid 2, Squid 3, Microsoft TMG Benchmark procedure: starting with cold cache, performing 50/500 operations in 3 consecutive runs, using a read/write ratio of 50/90/99% and a working set size of 300 objects Benchmarking the Protocol Further Information Single Client Scenario 50 100 150 200 250 300 / 1 300 / 2 300 / 3 3000 / 1 3000 / 2 3000 / 3 30000 / 1 30000 / 2 30000 / 3 Time [s] Setup [#objects/run] VOD native Orestes 0 100 200 300 400 500 600 O: Squid 2 O: Squid 3 O: TMG O: no cache VOD: native Latency [ms] Setup Cloud Computing Scenario Future Work Conclusions 0 0 125 50 Other (e.g. query) Reads Write Cache is warming up 1. Run 2. Run 3. Run 100 O: Squid 2 O: Squid 3 O: Squid3 pa. O: TMG O: no cache VOD: native Ops: 500, Reads: 99%, 3. Run Setup 450 reads/50 writes over 3 runs Read-heavy scenario, warm cache Execution Time [s] Execution Time [s] VOD native Orestes Preventing stale reads and transaction aborts using bloom filters: Client Orestes Server Database PUT/POST Object Writex Writex-1 . . Writey Write-Log now TTL days ago 1 0 0 1 1 0 1 1 h1 hk ... foreach(OID) OID bit vector (Bloom filter) hash functions GET Writes since TTL set bit to 1 Network Application Bloom-Filter I I I n n t t t t e e e e r r r r n n e e e e e t t t a a n n d d C C C a a a c c c h h h e e e s s s s Internet and Caches Write-Logging isStale(OID)? 0 1 0 1 1 0 0 1 1 0 1 1 contains? Make O(1) check before each GET Æ if necessary: revalidate Average execution time of 50 concurrent clients Benchmark procedure: starting with cold cache, 500 operations, 3 consecutive runs, read/write ratio of 90%, 300/3000/30000 total database objects, 50 concurrent clients Further caching support: server-side invalidation for content delivery networks and server-controlled reverse proxy caches. We achieved: Read scalability through web caching Considerable reduction of network latency Increase of read performance through caching of working sets Orestes: a novel approach to achieve read scalability for transactional object oriented persistence Open problem: write scalability Effects of cache hits: reducing the latency of object access by orders of magnitude local in-memory cache hits cache hits cache misses Scenario social networking OO model inheritance, aggregation, etc. Access pattern transactional navigation Database Versant Object Database (VOD) Persistence API Java Data Objects (JDO) Protocols VOD TCP, Orestes Caches JDO L2 (VOD), web caches (Orestes) Concurrency single client, 50 parallel clients Database Generic Orestes HTTP Protocol Internet Java Data Objects Java Persistence API Port pm.makePersistent(obj) JavaScript Java pm.getObjectById(id) pm.newQuery(qry) em.persist(obj) em.find(cls,id) em.createQuery(qry,cls) HTTP Persistence API Generic Orestes HTTP Protocol HTTP Versant Object Database db4o Binding Binding Optional web cache in client's network (forward proxy cache) Optional web cache in servers's network (reverse proxy cache) Web Cache Web Cache Cluster GET /db/sim.classes/Person/22517998 If-None-Match: "2" Cache-Control: max-age=0 Accept: application/json Works in web browser (AJAX) and Node.js Caches at ISPs HTTP request HTTP response { "_objectInfo": { "class": "/db/sim.classes/Person", "oid": "/db/sim.classes/Person/22517998", "version": "2" }, "/db/sim.classes/Site": { "owner": "/db/sim.classes/Person/22517998", "title": "Profile of Bethold Birnenbaum", "posts": [], "design": "Colorful" }, "/db/sim.classes/Person": { "status": "Chilling!", "family": [], "friends": [], "profile": "/db/sim.classes/Profile/22517998", "games": [] } } 200 OK Cache-Control: public,max-age=1209600 Content-Type: application/json ETag: "2" Content Delivery Networks (CDN) Synchronization: Optimistic concurrency control to deal with stale objects Implementation: Generic network layer, 2 persistence APIs, 2 DB bindings

Upload: dangdiep

Post on 04-Jan-2017

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: a REST protocol for horizontally scalable cloud database access

Amazon EC2 Ireland

Benchmark Instance

Web-Fronted

Benchmark Instance

Web-Fronted

...OS: Windows ServerSize: 1 core, 1 GB RAM

50 parallel instances

Benchmark Instance

Web-Fronted

Launched simultaneously

IIIInnttterrnnnneeeeettttInternetSquid Web

Cache

OS: LinuxSize: 2 cores, 7.5 GB RAM

Ore

stes Versant

Object Database

OS: Windows ServerSize: 2 cores, 7.5 GB RAM

Laun

cher

165ms Amazon EC2 California

Orestes: a REST protocol for horizontally scalable cloud database access

Observations

Reduction of server load Low latency

IIIIIIInnnnttttteeeeeerrrrrnnnnnnnneeeeeeeeetttttttttttInternet OrestesCache

Arrivingrequests

Requests reaching the server

IIIIIIInnnttttttteeeeeerrrrrnnnnnnnnnneeeeeeeettttttttttttInternetOrestes Cache

Low latency High latency

Orestes

Arbitrary combinations of persistence API and DB Reads scale horizontally

JavaScript JPA Orestes

Open protocol

Orestes

HTTP and JSON

VOD

Java JDO Orestes Orestes db4o

Different database systemsDifferent programming languages / APIs

IIIIIIInnnntttttteeeeeerrrrrnnnnnnnneeeeeeeeettttttttttttInternet OrestesLoad-Balancer

Arrivingrequests Scale-out

B

CacheCacheCacheCache writes

changes

Reads don't reach the server

PPPPPPPPPaaaaaaaaaaaaaaaaaaSSSSSSSSSSSCCCCClllooooooouuuuuuuuddddddddddddddPaaSCloud

CCCCCCllllllooooouuuuuuuuddddddddddddCloudOrestes as a

ServiceO

Orestes ApplicationOrestes

Application deployed in cloud

On premise application

Firewalls, proxys, load-balancers

AAAAAAAAAAA

Cloud and service capable DB interface

Browser persistence and administration

IIIIIIIInnnntttttteeeeeerrrrnnnnnnnneeeeeeeeettttttttttttInternet Orestes

Remote database

Browser

Accounts, data analysis, monitoring...

Direct database access from client side

s

Solution

Open problems: Database as a service, cloud computing

network latency Web-scale applications, commodity hardware

scalability issues Goal: Scalable, cloud capable database systems Our approach: ORESTES (Objects RESTfully encapsulated in standard formats)

Property Mechanism

Read scalability Web caching of database objects

Low latency Cache deployment in client network

Loose coupling of persistence API and DB

Generic HTTP access protocol and resource structure

Standard formats

Extensible HTTP content negotiation + default JSON formats

Felix Gessert, Florian Bücklers, Norbert Ritter University of Hamburg

Illustration of the Key Properties

System Overview

Caching mechanism: HTTP caching with statically assigned object lifetimes

Server

Persistence API

OrestesInterface RESTful HTTP

Orestes Protocol

Database Interface

OrestesClient

D bPersistence

Client

OrestesServer

OrestesInterface

Application Database

Scales horizontally

Orestes layer

Visit us at the URL http://orestes.info or contact us via email: [email protected]

Orestesserver(America)

caches(Hamburg)

benchmarkclient(Hamburg) 1 2 3

123

Orestes without cache

VOD native

Orestes with cacheOrestesO

IIIIIIIIIIInnnnnnnnnnnttttttttteeeeeeeeeeeeeeerrrrrrrrrrrrnnnnnnnnnnnnnnneeeeeeeeeeeeeeeeeeeetttttttttttInternet

LL2-JDOCaaache

L2-JDOCache

Different forward proxy caches

Round-trip time 180ms ± 5ms

Compared benchmark setups

Squid 2, Squid 3, Microsoft TMG

Benchmark procedure: starting with cold cache, performing 50/500 operations in 3 consecutive runs, using a read/write ratio of 50/90/99% and a working set size of 300 objects

Benchmarking the Protocol

Further Information

Single Client Scenario

50 100 150 200 250

300 / 1300 / 2300 / 3

3000 / 13000 / 23000 / 3

30000 / 130000 / 230000 / 3

Time [s]

Setu

p [#

obje

cts/

run]

VOD nativeOrestes

0 100 200 300 400 500 600

O: Squid 2O: Squid 3

O: TMGO: no cacheVOD: native

Latency [ms]

Setu

p

Cloud Computing Scenario Future Work

Conclusions

00 12550

Other (e.g. query)ReadsWrite

Cache is warming up

1. Run

2. Run

3. Run

100

O: Squid 2

O: Squid 3

O: Squid3 pa.

O: TMG

O: no cache

VOD: native

Ops: 500, Reads: 99%, 3. Run

Setu

p

450 reads/50 writes over 3 runs

Read-heavy scenario, warm cache

Execution Time [s] Execution Time [s]

VOD native Orestes

Preventing stale reads and transaction aborts using bloom filters:

ClientOrestesServer

Database

PUT/POST ObjectWritexWritex-1..Writey

Write-Lognow

TTL days ago

1 0 0 1 1 0 1 1h1

hk

...

foreach(OID)

OID

bit vector(Bloom filter)

hash functions

GET Writes since TTL

set bit to 1

Network Application

Bloo

m-F

ilter

IIInntttteeeerrrrnneeeeetttaannddd CCCaaaccchhheeessss

Internetand Caches

Writ

e-Lo

ggin

g

isStale(OID)?

1 0 0 1 1 0 1 1

1 0 0 1 1 0 1 1

contains?

Make O(1) check before each GET

if necessary: revalidate

Average execution time of 50 concurrent clients

Benchmark procedure: starting with cold cache, 500 operations, 3 consecutive runs, read/write ratio of 90%, 300/3000/30000 total database objects, 50 concurrent clients

Further caching support: server-side invalidation for content delivery networks and server-controlled reverse proxy caches.

We achieved: • Read scalability through web caching• Considerable reduction of network latency • Increase of read performance through caching of

working sets Orestes: a novel approach to achieve read scalability for transactional object oriented persistenceOpen problem: write scalability

Effects of cache hits: reducing the latency of object access by orders of magnitude

local in-memory cache hits

cache hits cache misses

Scenario social networking OO model inheritance, aggregation, etc. Access pattern transactional navigation Database Versant Object Database (VOD) Persistence API Java Data Objects (JDO) Protocols VOD TCP, Orestes Caches JDO L2 (VOD), web caches (Orestes) Concurrency single client, 50 parallel clients

DatabaseGeneric Orestes HTTP Protocol Internet

Java Data Objects

Java Persistence

API Port

pm.makePersistent(obj)

JavaScript

Java

pm.getObjectById(id)

pm.newQuery(qry)

em.persist(obj)

em.find(cls,id)

em.createQuery(qry,cls)

HTTP

Persistence API Generic Orestes HTTP Protocol

HTTP

Versant Object

Database

db4o

Bind

ing

Bind

ing

Optional web cache in client's network (forward proxy cache)

Optional web cache in servers's network (reverse proxy cache)

Web Cache

Web Cache Cluster

GET /db/sim.classes/Person/22517998If-None-Match: "2"Cache-Control: max-age=0Accept: application/json

Works in web browser (AJAX) and Node.js

Caches at ISPs

HTTP requestHTTP response

{ "_objectInfo": { "class": "/db/sim.classes/Person", "oid": "/db/sim.classes/Person/22517998", "version": "2" }, "/db/sim.classes/Site": { "owner": "/db/sim.classes/Person/22517998", "title": "Profile of Bethold Birnenbaum", "posts": [], "design": "Colorful" }, "/db/sim.classes/Person": { "status": "Chilling!", "family": [], "friends": [], "profile": "/db/sim.classes/Profile/22517998", "games": [] }}

200 OKCache-Control: public,max-age=1209600Content-Type: application/jsonETag: "2"

Content Delivery Networks (CDN)

Synchronization: Optimistic concurrency control to deal with stale objects

Implementation: Generic network layer, 2 persistence APIs, 2 DB bindings