Gofer. A scalable stateless proxy for DBI



Similar documents
Scalability of web applications. CSCI 470: Web Science Keith Vertanen

Tier Architectures. Kathleen Durant CS 3200

Common Server Setups For Your Web Application - Part II

Exploring Oracle E-Business Suite Load Balancing Options. Venkat Perumal IT Convergence

JBoss Seam Performance and Scalability on Dell PowerEdge 1855 Blade Servers

LOAD BALANCING TECHNIQUES FOR RELEASE 11i AND RELEASE 12 E-BUSINESS ENVIRONMENTS

Using Oracle Real Application Clusters (RAC)

DEPLOYMENT GUIDE Version 1.1. Deploying the BIG-IP LTM v10 with Citrix Presentation Server 4.5

IT Best Practices Audit TCS offers a wide range of IT Best Practices Audit content covering 15 subjects and over 2200 topics, including:

Top 10 Performance Tips for OBI-EE

Cognos8 Deployment Best Practices for Performance/Scalability. Barnaby Cole Practice Lead, Technical Services

Web Application Development

Apache Traffic Server Extensible Host Resolution

Brocade Virtual Traffic Manager and Microsoft IIS Deployment Guide

Oracle Weblogic. Setup, Configuration, Tuning, and Considerations. Presented by: Michael Hogan Sr. Technical Consultant at Enkitec

Using DataDirect Connect for JDBC with Oracle Real Application Clusters (RAC)

scalability OneBridge

Security Testing For RESTful Applications

How To Balance A Load Balancer On A Server On A Linux (Or Ipa) (Or Ahem) (For Ahem/Netnet) (On A Linux) (Permanent) (Netnet/Netlan) (Un

Layers of Caching: Key to scaling your website. Lance Albertson -- Narayan Newton

SaaS-Based Employee Benefits Enrollment System

Veriton. Getting the Best out of Hardware Load Balancers in an Oracle Environment. What is a Load Balancer? Agenda. What s out there?

Understanding Slow Start

Deploying the BIG-IP System v10 with Oracle Application Server 10g R2

CLUSTERING CAS for High Availability. Eric Pierce, University of South Florida

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

XTM Web 2.0 Enterprise Architecture Hardware Implementation Guidelines. A.Zydroń 18 April Page 1 of 12

JBoss & Infinispan open source data grids for the cloud era

Mirjam van Olst. Best Practices & Considerations for Designing Your SharePoint Logical Architecture

ZingMe Practice For Building Scalable PHP Website. By Chau Nguyen Nhat Thanh ZingMe Technical Manager Web Technical - VNG

DEPLOYMENT GUIDE. Deploying the BIG-IP LTM v9.x with Microsoft Windows Server 2008 Terminal Services

BeBanjo Infrastructure and Security Overview

Load Balancing and Sessions. C. Kopparapu, Load Balancing Servers, Firewalls and Caches. Wiley, 2002.

HAProxy. Ryan O'Hara Principal Software Engineer, Red Hat September 17, HAProxy

Customer Bank Account Management System Technical Specification Document

Cisco Application Networking for IBM WebSphere

Database Scalability and Oracle 12c

DEPLOYMENT GUIDE DEPLOYING THE BIG-IP LTM SYSTEM WITH MICROSOFT WINDOWS SERVER 2008 TERMINAL SERVICES

Designing and Developing Web Applications by using the Microsoft.NET Framework

DEPLOYMENT GUIDE Version 1.1. Deploying F5 with Oracle Application Server 10g

Basic & Advanced Administration for Citrix NetScaler 9.2

Centralized logging system based on WebSockets protocol

DEPLOYMENT GUIDE Version 1.2. Deploying F5 with Oracle E-Business Suite 12

1. Comments on reviews a. Need to avoid just summarizing web page asks you for:

QL Integration into Scala and Excel. Martin Dietrich

Brocade Virtual Traffic Manager and Oracle EBS 12.1 Deployment Guide

SCALABLE DATA SERVICES

Programming Hadoop 5-day, instructor-led BD-106. MapReduce Overview. Hadoop Overview

Chapter 4. Architecture. Table of Contents. J2EE Technology Application Servers. Application Models

Qualogy M. Schildmeijer. Whitepaper Oracle Exalogic FMW Optimization

High Availability HTTP/S. R.P. (Adi) Aditya Senior Network Architect

Who are We Specialized. Recognized. Preferred. The right partner makes all the difference.

Active-Active and High Availability

WEBLOGIC ADMINISTRATION

Developing Windows Azure and Web Services

Scaling Progress OpenEdge Appservers. Syed Irfan Pasha Principal QA Engineer Progress Software

DEPLOYMENT GUIDE Version 1.2. Deploying the BIG-IP System v10 with Microsoft IIS 7.0 and 7.5

DEPLOYMENT GUIDE DEPLOYING F5 WITH MICROSOFT WINDOWS SERVER 2008

Open-Xchange Whitepaper Open-Xchange Server 6 Architecture Overview

1 Discussion of multithreading on Win32 mod_perl

Agenda. Tomcat Versions Troubleshooting management Tomcat Connectors HTTP Protocal and Performance Log Tuning JVM Tuning Load balancing Tomcat

Cloud Based Application Architectures using Smart Computing

Performance Tuning and Optimizing SQL Databases 2016

OTM Performance OTM Users Conference Jim Mooney Vice President, Product Development August 11, 2015

Fairsail REST API: Guide for Developers

REST web services. Representational State Transfer Author: Nemanja Kojic

Availability Digest. Redundant Load Balancing for High Availability July 2013

DEPLOYMENT GUIDE Version 1.2. Deploying the BIG-IP system v10 with Microsoft Exchange Outlook Web Access 2007

BUILDING HIGH-AVAILABILITY SERVICES IN JAVA

Tushar Joshi Turtle Networks Ltd

Managing your Red Hat Enterprise Linux guests with RHN Satellite

JBS-102: Jboss Application Server Administration. Course Length: 4 days

Architectural Overview

Oracle Collaboration Suite

SiteCelerate white paper

Apache Tomcat. Load-balancing and Clustering. Mark Thomas, 20 November Pivotal Software, Inc. All rights reserved.

Load Balancing in Cluster

Chapter 2 TOPOLOGY SELECTION. SYS-ED/ Computer Education Techniques, Inc.

MagDiSoft Web Solutions Office No. 102, Bramha Majestic, NIBM Road Kondhwa, Pune Tel: /

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

A CC/PP aware Apache Web Server

Building Scalable Applications Using Microsoft Technologies

DEPLOYMENT GUIDE DEPLOYING THE BIG-IP SYSTEM WITH MICROSOFT INTERNET INFORMATION SERVICES (IIS) 7.0

Technology Insight Series

Big Data with Component Based Software

Clustering Versus Shared Nothing: A Case Study

Planning the Migration of Enterprise Applications to the Cloud

The Cloud to the rescue!

Repeat Success, Not Mistakes; Use DDS Best Practices to Design Your Complex Distributed Systems

Cisco Application Networking for BEA WebLogic

Architectural patterns for building real time applications with Apache HBase. Andrew Purtell Committer and PMC, Apache HBase

LinuxWorld Conference & Expo Server Farms and XML Web Services

Transcription:

Gofer A scalable stateless proxy for DBI 1

Gofer, logically Gofer is - A scalable stateless proxy architecture for DBI - Transport independent - Highly configuable on client and server side - Efficient, in CPU time and minimal round-trips - Well tested - Scalable - Cachable - Simple and reliable 2

Gofer, structurally Gofer is - A simple stateless request/response protocol - A DBI proxy driver: DBD::Gofer - A request executor module - A set of pluggable transport modules - An extensible client configuration mechanism Development sponsored by Shopzilla.com 3

Gofer Protocol DBI::Gofer::Request & DBI::Gofer::Response Simple blessed hashes - Request contains all required information to connect and execute the requested methods. - Response contains results from methods calls, including result sets (rows of data). Serialized and transported by transport modules like DBI::Gofer::Transport::http 4

Using DBD::Gofer Via DSN - By adding a prefix $dsn = dbi:driver:dbname ; $dsn = dbi:gofer:transport=foo;dsn=$dsn ; Via DBI_AUTOPROXY environment variable - Automatically applies to all DBI connect calls $ export DBI_AUTOPROXY= dbi:gofer:transport=foo ; - No code changes required! 5

Gofer Transports DBI::Gofer::Transport::null - The null transport. - Serializes request object, transports it nowhere, then deserializes and passes it to DBI::Gofer::Execute to execute - Serializes response object, transports it nowhere, then deserializes and returns it to caller - Very useful for testing. DBI_AUTOPROXY= dbi:gofer:transport=null 6

Gofer Transports DBD::Gofer::Transport::stream (ssh) - Can ssh to remote system to self-start server ssh -xq user@host.domain \ perl -MDBI::Gofer::Transport::stream \ -e run_stdio_hex - Automatically reconnects if required - ssh gives you security and optional compression DBI_AUTOPROXY= dbi:gofer:transport=stream ;url=ssh:user@host.domain 7

Gofer Transports DBD::Gofer::Transport::http - Sends requests as http POST requests - Server typically Apache mod_perl running DBI::Gofer::Transport::http - Very flexible server-side configuration options - Can use https for security - Can use web techniques for scaling and highavailability. Will support web caching. DBI_AUTOPROXY= dbi:gofer:transport=http ;url=http://example.com/gofer 8

Gofer Transports DBD::Gofer::Transport::gearman - Distributes requests to a pool of workers - Gearman a lightweight distributed job queue http://www.danga.com/gearman - Gearman is implemented by the same people who wrote memcached, perlbal, mogilefs, & DJabberd DBI_AUTOPROXY= dbi:gofer:transport=gearman ;url=http://example.com/gofer 9

Pooling via gearman vs http I haven t compared them in use myself yet + Gearman may have lower latency + Gearman spreads load over multiple machines without need for load-balancer + Gearman coalescing may be beneficial + Gearman async client may work well with POE - Gearman clients need to be told about servers More gearman info http://danga.com/words/ 2007_04_linuxfest_nw/linuxfest.pdf (p61+) 10

DBD::Gofer A proxy driver Accumulates details of DBI method calls Delays forwarding request for as long as possible Aims to be as transparent as possible Policy mechanism allows fine-grained tuning to trade transparency for speed execute_array() is a single round-trip 11

DBD::Gofer::Policy::* Three policies supplied: pedantic, classic, and rush. Classic is the default. Policies are implemented as classes Currently 22 individual items within a policy Policy items can be dynamic methods Policy is selected via DSN: DBI_AUTOPROXY= dbi:gofer:transport=null ;policy=pedantic 12

Round-trips per Policy pedantic classic rush $dbh = DBI->connect_cached $dbh->ping connect() $dbh->quote $sth = $dbh->prepare $sth->execute if not default if not default $sth->{num_of_fields} $sth->fetchrow_array $dbh->tables cached after first 13

Gofer Caveats State-less-ness has implications - No transactions. AutoCommit only. - Can t alter $dbh attributes after connect - Can t use temp tables, locks, and other per-connection persistent state, except via stored procedures - Code using last_insert_id needs a (simple) change - See the docs for a few other very obscure caveats 14

An Example Using Gofer for Connection Pooling 15

The Problem Apache s 40 worker processes per server + 150 servers = 1 overloaded database Database Server - 16

A Solution - Apache s A database proxy that does connection pooling Holds a few connections open Uses them to service DBI requests Database Server Repeat for all servers 17

An Implementation Apache s Standard apache+mod_perl Apache!"#$%#& DBI + DBD::* DBI::Gofer::Execute and DBI::Gofer::Transport::http modules implement stateless proxy Database Server - DBD::Gofer with http transport 18

Load Balance and Cache server with 40 workers x 150 servers - Many = 6000 db web servers connections HTTP Load Balancer and Cache Apache running DBI Gofer Apache running DBI Gofer New middle tier s s Gofer Servers High performance load balancing and fail-over Far fewer db connections Database Server Caching results would reduce db load even further (not yet implemented) 19

Error Handling DBD::Gofer can automatically retry on failure DBI_AUTOPROXY= dbi:gofer:transport=null ;retry_limit=3 Default behaviour is to retry if $request->is_idemponent is true - looks at SQL returns true for most SELECTs Default is retry_limit=0, so disabled You can define your own behaviour: DBI->connect(..., { go_retry_hook => sub {... }, }); 20

DBD::Proxy vs DBD::Gofer DBD::Proxy DBD::Gofer Supports transactions (not yet) Supports very large results (memory) Automatic retry on error Large test suite Minimal round-trips Modular & Pluggable classes Tunable via Policies Scalable Connection pooling Can support client and web caches (not yet) 21

Gofer s Future Caching for http transport Optional JSON serialization Caching in DBD::Gofer Make state-less-ness optional Patches welcome! 22

Future: http caching Potential big win DBD::Gofer needs to indicate cache-ability - via appropriate http headers Server side needs to agree - and respond with appropriate http headers Caching then happens just like for web pages - if there s a web cache between client and server Patches welcome! 23

Future: JSON Turns DBI into a web service! - Service Oriented Architecture anyone? Accessible to anything - that can talk JSON Clients could be JavaScript, Java,... - and various languages that begin with P or Patches welcome! 24

Future: Client Caching DBD::Gofer could access a cache - Use serialized request as key to cache - If entry found then return that response Plug-able caching - Would include memcached to give a distributed shared cache Patches welcome! 25

Future: Transactions State-less-ness could be made optional - If transport layer being used agrees - For http that means KeepAlive - Easiest to implement for stream / ssh Would be enabled by AutoCommit => 0 $dbh->begin_work Patches welcome! 26

Questions? 27