Perlbal: Reverse Proxy & Webserver



Similar documents
Inside LiveJournal's Backend or, holy hell that's a lot of hits!

Load Balancing with Perlbal

Accelerating Rails with

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

Building Scalable Web Sites: Tidbits from the sites that made it work. Gabe Rudy

WebGUI Load Balancing

Scalability and Performance with Apache 2.0

The course will be run on a Linux platform, but it is suitable for all UNIX based deployments.

One Server Per City: C Using TCP for Very Large SIP Servers. Kumiko Ono Henning Schulzrinne {kumiko, hgs}@cs.columbia.edu

ZEN LOAD BALANCER EE v3.04 DATASHEET The Load Balancing made easy

ZEN LOAD BALANCER EE v3.02 DATASHEET The Load Balancing made easy

Web Application Testing. Web Performance Testing

Integrating the F5 BigIP with Blackboard

Setting Up a CLucene and PostgreSQL Federation

HAProxy. Free, Fast High Availability and Load Balancing. Adam Thornton 10 September 2014

Apache Tomcat & Reverse Proxies

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

Implementing Reverse Proxy Using Squid. Prepared By Visolve Squid Team

1. Stem. Configuration and Use of Stem

Apache httpd v2.4: Reverse Proxy. (The Hidden Gem) Jim Jagielski

Apache CloudStack 4.x (incubating) Network Setup: excerpt from Installation Guide. Revised February 28, :32 pm Pacific

LiveJournal: Behind The Scenes Scaling Storytime

Administering Jive for Outlook

Centralize AIX LPAR and Server Management With NIM

Comparing the Performance of Web Server Architectures

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Introducing the Microsoft IIS deployment guide

24x7 Scheduler Multi-platform Edition 5.2

New Relic & JMeter - Perfect Performance Testing

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Achieving High Availability with Websphere Application Server SIP Container and F5 BIG-IP Local Traffic Manager

IBM Tivoli Composite Application Manager for Microsoft Applications: Microsoft Hyper-V Server Agent Version Fix Pack 2.

Load Balancing Oracle Application Server (Oracle HTTP Server) Quick Reference Guide

Required Ports and Protocols. Communication Direction Protocol and Port Purpose Enterprise Controller Port 443, then Port Port 8005

EView/400i Management Pack for Systems Center Operations Manager (SCOM)

PeopleSoft Online Performance Guidelines

Integrated Cisco Products

TFE listener architecture. Matt Klein, Staff Software Engineer Twitter Front End

Configuring IBM HTTP Server as a Reverse Proxy Server for SAS 9.3 Web Applications Deployed on IBM WebSphere Application Server

Summer Internship 2013

OpenSAF A Standardized HA Solution

How To Use Ngnix (Php) With A Php-Fpm (Php-Fmm) On A Web Server (Php5) On Your Web Browser) On An Ubuntu Web Server On A Raspberry Web 2.5 (Net

IUCLID 5 Guidance and Support

FILECLOUD HIGH AVAILABILITY

Chapter 3 Operating-System Structures

Managing your Red Hat Enterprise Linux guests with RHN Satellite

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

Apache Thrift and Ruby

DEPLOYMENT GUIDE Version 1.0. Deploying the BIG-IP LTM with Apache Tomcat and Apache HTTP Server

2 Downloading Access Manager 3.1 SP4 IR1

Configuring Nex-Gen Web Load Balancer

Novell Access Manager

Deployment Guide Oracle Siebel CRM

Deployment Guide Microsoft IIS 7.0

Understanding Slow Start

<Insert Picture Here> Introducing Hudson. Winston Prakash. Click to edit Master subtitle style

FileBench's Multi-Client feature

McAfee Web Gateway 7.4.1

Exclaimer Mail Archiver User Manual

Nevepoint Access Manager 1.2 BETA Documentation

Oracle9i Application Server: Options for Running Active Server Pages. An Oracle White Paper July 2001

FileMaker Server 15. Getting Started Guide

Distributed File Systems

Red Hat Enterprise Linux (RHEL 6) Courses

Snapt Balancer Manual

Introduction. AppDynamics for Databases Version Page 1

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

NethServer - Feature #1126 Bandwidth Monitor (NTOP)

Data Movement and Storage. Drew Dolgert and previous contributors

Benchmarking FreeBSD. Ivan Voras

20 Command Line Tools to Monitor Linux Performance

The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology

Managing your Domino Clusters

Loadbalancer.org Appliance Setup v5.9

Informatica Corporation Proactive Monitoring for PowerCenter Operations Version 3.0 Release Notes May 2014

Tue Apr 19 11:03:19 PDT 2005 by Andrew Gristina thanks to Luca Deri and the ntop team

Smartphone Pentest Framework v0.1. User Guide

WebAccelerator Administration Guide

How Comcast Built An Open Source Content Delivery Network National Engineering & Technical Operations

Tomcat Tuning. Mark Thomas April 2009

Cloud Computing for Control Systems CERN Openlab Summer Student Program 9/9/2011 ARSALAAN AHMED SHAIKH

Copyright 2014 Oracle and/or its affiliates. All rights reserved.

Drupal Performance Tuning

CHAPTER 3 PROBLEM STATEMENT AND RESEARCH METHODOLOGY

Jive and High-Availability

Virtual Private Systems for FreeBSD

ontune SPA - Server Performance Monitor and Analysis Tool

Web Server Deathmatch

Intro to Load-Balancing Tomcat with httpd and mod_jk

Features. The Samhain HIDS. Overview of available features. Rainer Wichmann

VDCF - Virtual Datacenter Control Framework for the Solaris TM Operating System

TRACE PERFORMANCE TESTING APPROACH. Overview. Approach. Flow. Attributes

SDFS Overview. By Sam Silverberg

Intrusion Detection Systems (IDS)

Transcription:

Perlbal: Reverse Proxy & Webserver Brad Fitzpatrick brad@danga.com Danga Interactive Open Source company Services Tools LiveJournal.com PicPix.com (soon) / pics.livejournal.com DBI::Role memcached mogilefs (distributed filesystem) Perlbal

Features Reverse proxy load balancer Buffers backend responses frees heavy mod_perl/mod_php/mod_foo early Can internally reproxy to another URL or file Web server mode (after thought) survives when thttpd hasn't, uses epoll 'epoll', for handling many connections efficiently. 'sendfile' for less CPU usage Console/HTTP management

Why not just? Buffering BIG-IP does ~16k configurable in 9.x, but limited memory on a single box Apache does ~128k (tcp send buffer). can tell kernel to increase. Internal proxy client sees no redirect switch between internal servers auth/uri trans in mod_perl/etc quick webserver (thttpd/tux/perlbal) skipping ahead: IO::Sendfile! Custom LB / no proxy connect errors

Web server mode Why reproxy to another webserver? Why not reproxy to a file? Hard work already done nonblock network easy nonblock VFS stuff harder nonblock stat() / open() hard once open, sendfile() to nonblock socket no prob: IO::SendFile

Our setup Two BIG-IPs (active / standby) vip livejournal.com:80 = 4 perlbals Previously: to 4 mod_proxy, to mod_rewrite, to external rewrite map prg: doing sendstats (like mod_backhand) Sendstats no longer necessary: persistent backend connections 1.0 only, don't have to dechunk, dynamic responses rare verify backends with OPTIONS talking to Apache, not kernel

Perlbal::Socket Singleton event loop constructor registers self with event loop; single threaded, non-blocking, event-based POE-like uses epoll (Linux 2.6) or poll IO::Poll flakey. use IO::Poll::_poll which is reliable. epoll via perl's 'syscall'. IO::Epoll was flakey. Later found useful for ddlockd, mogilefsd, etc pushed down into Danga::Socket

use fields so damn cool compile-time member checking 'use strict' for OO when typed (my Foo $a), then hash access are actually array accesses ($a->{bar} compiles to $a->[18]) run-time member checking when not typed hash+array lookup. still strict. confidence to do big OO projects

Linux::AIO uses linux's clone() shared pipe to cloned child to alert of waiting jobs fd parent can [e]poll on. Linux::AIO calls closure when told to (via fd readiness) before this, cycles not portable may change to thttpd style: unix socket to blocking IO workers. pass fds.

doo dads management port every console command can be in config file or set at runtime console commands that look like HTTP are treated as such, and web UI runs (ssh -L8065: proxy:8065... http://localhost:8065/) connect-ahead

Perlbal Plug-ins hooks into core Perlbal code as needed now. documented. could add more. currently plug-ins for stats (counts connections) queues (shows queue depths) palette modifications on GIF/PNG lets user customize their colors and makes accompanying images match theme, without dynamically generating the images. palette table is in first few bytes, then sendfile() the rest. de-animate GIFs (upcoming, byte toggle)

MogileFS distributed file system; HTTP PUT support storage nodes have disks files are on 'n' disks on different hosts Min replica count 'n' based on class of file Dozens of NFS problems nfs_inode_cache, corruption, export limitations Perlbal! storage nodes run Perlbal for GETs how to PUT? PUT support, optional (off by default) change wrapper script so no config needed

Code: Linux::AIO Linux::AIO::aio_stat($file, sub { return if $self->{closed}; # client away return $self->_simple_response(404) unless -e _;... Linux::AIO::aio_open($file, 0, 0, sub { my $rp_fd = shift;... $self->state('xfer_disk'); $self->tcp_cork(1); # cork writes to self $self->write($res->to_string_ref); $self->reproxy_fd($rp_fd, $size); }); });

Code: epoll wrappers our $HAVE_SYSCALL_PH = eval { require 'syscall.ph'; 1 }; our $SYS_epoll_create = eval { &SYS_epoll_create }; our $SYS_epoll_ctl = eval { &SYS_epoll_ctl }; # ARGS: (size) sub epoll_create { my $epfd = eval { syscall($sys_epoll_create, $_[0]) }; return -1 if $@; return $epfd; } # ARGS: (epfd, op, fd, events) sub epoll_ctl { syscall($sys_epoll_ctl, $_[0]+0, $_[1]+0, $_[2]+0, pack("lll", $_[3], $_[2])); } # <snip> epoll_wait...

Code: use fields package Rect; use base Shape; use fields qw(width height); sub new { my Rect $self = shift; $self = fields::new($self) unless ref $self; ($self->{width}, $self->{height}) = @_; return $self; }... my Rect $rect = Rect->new(10, 20); print $rect->{hieght}\n ; # ^^^^^^ # COMPILE-TIME ERROR! (or runtime error without typing) # Compiles to: $rect->[14] (or whatever index)

Questions? the end. Brad Fitzpatrick brad@danga.com Mark Smith marksmith@danga.com Danga Interactive http://www.danga.com/ All our stuff's Open Source: http://cvs.danga.com/ http://cvs.livejournal.org/