Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

616 lines (541 sloc) 15.043 kB
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<meta name="version" content="S5 1.1" />
<title>Ad Serving in Erlang</title>
<meta name="author" content="Bob Ippolito" />
<meta name="date" content="November 2008" />
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 5196 2007-06-03 20:25:28Z wiemann $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-right {
clear: right }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
margin-left: 2em ;
margin-right: 2em }
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
<!-- configuration parameters -->
<meta name="defaultView" content="slideshow" />
<meta name="controlVis" content="hidden" />
<!-- style sheet links -->
<script src="ui/mochikit/slides.js" type="text/javascript"></script>
<link rel="stylesheet" href="ui/mochikit/slides.css"
type="text/css" media="projection" id="slideProj" />
<link rel="stylesheet" href="ui/mochikit/outline.css"
type="text/css" media="screen" id="outlineStyle" />
<link rel="stylesheet" href="ui/mochikit/print.css"
type="text/css" media="print" id="slidePrint" />
<link rel="stylesheet" href="ui/mochikit/opera.css"
type="text/css" media="projection" id="operaFix" />
<style type="text/css">
#currentSlide {display: none;}
</style>
</head>
<body>
<div class="layout">
<div id="controls"></div>
<div id="currentSlide"></div>
<div id="header">
</div>
<div id="footer">
<h1>Ad Serving in Erlang</h1>
</div>
</div>
<div class="presentation">
<div class="slide" id="slide0">
<h1 class="title">Ad Serving in Erlang</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>Bob Ippolito</td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>November 2008</td></tr>
<tr class="field"><th class="docinfo-name">Venue:</th><td class="field-body">Erlang User Conference 2008</td>
</tr>
</tbody>
</table>
<!-- Definitions of interpreted text roles (classes) for S5/HTML data. -->
<!-- This data file has been placed in the public domain. -->
<!-- Colours
======= -->
<!-- Text Sizes
========== -->
<!-- Display in Slides (Presentation Mode) Only
========================================== -->
<!-- Display in Outline Mode Only
============================ -->
<!-- Display in Print Only
===================== -->
<!-- Display in Handout Mode Only
============================ -->
<!-- Incremental Display
=================== -->
<!-- colors -->
<!-- =========================== -->
<!-- general useful commands -->
<!-- =========================== -->
<!-- closed bracket -->
<!-- =========================== -->
<!-- example block -->
<!-- =========================== -->
<!-- alert block -->
<!-- =========================== -->
<!-- columns -->
<!-- =========================== -->
<script type="text/javascript">
addLoadEvent(function () {
appendChildNodes(document.body,
DIV({id: "mochikit_logo", 'class': 'draggable'}));
});
</script>
</div>
<div class="slide" id="what-s-mochiads">
<h1>What's MochiAds?</h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">MochiAds:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li>Monetization platform for Flash game ecosystem</li>
<li>Advertising solution for game developers</li>
<li>Revenue share and distribution for publishers</li>
</ul>
</div>
<div class="slide" id="road-to-erlang">
<h1>Road to Erlang</h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">MochiBot:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li>(Originally) Python w/ Twisted</li>
<li>Fast, but not fast enough (CPU bound)</li>
<li>Wanted easy multi-node distribution</li>
</ul>
</div>
<div class="slide" id="previous-experience">
<h1>Previous Experience</h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Python:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li>Non-blocking sockets are tedious</li>
<li>Threads are too heavy</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">C/C++:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li>Too low-level</li>
</ul>
</div>
<div class="slide" id="why-erlang">
<h1>Why Erlang?</h1>
<ul class="simple">
<li>Performance</li>
<li>Concurrency</li>
<li>Distribution</li>
<li>Fault Tolerance</li>
</ul>
</div>
<div class="slide" id="bad-benchmarks">
<h1>(Bad) Benchmarks</h1>
<p>ab -c 50 -n 10000 localhost</p>
<ul class="simple">
<li>Apache: 1x</li>
<li>Twisted: 1.12x</li>
<li>mochiweb: 2.5x</li>
<li>nginx: 3.9x</li>
</ul>
</div>
<div class="slide" id="erlang-at-mochi-media">
<h1>Erlang at Mochi Media</h1>
<p>MochiAds, MochiBot</p>
<ul class="simple">
<li>High-performance HTTP servers</li>
<li>Ad targeting</li>
<li>Real-time analytics</li>
<li>Social gaming</li>
<li>Lots of internal use</li>
</ul>
</div>
<div class="slide" id="mochiads-service">
<h1>MochiAds Service</h1>
<ul class="simple">
<li>Front-end</li>
<li>Data warehouse</li>
<li>Ad server</li>
</ul>
</div>
<div class="slide" id="what-s-not-erlang">
<h1>What's Not Erlang</h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Front-end:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li>Python and PostgreSQL</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Data warehouse:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<ul class="simple">
<li>Python and Vertica</li>
</ul>
</div>
<div class="slide" id="ad-serving-platform">
<h1>Ad Serving Platform</h1>
<ul class="simple">
<li>Juniper Routers</li>
<li>Cisco Switches</li>
<li>OpenBSD load balancer</li>
<li>Nginx HTTP load balancer (Linux)</li>
<li>Erlang/OTP R12B-3 (Linux)</li>
</ul>
</div>
<div class="slide" id="ad-server-stack">
<h1>Ad Server Stack</h1>
<ul class="simple">
<li>Erlang/OTP R12B-3</li>
<li>mochiweb (http)</li>
<li>egeoip (geolocation)</li>
<li>eswf (SWF file format)</li>
</ul>
</div>
<div class="slide" id="ad-server">
<h1>Ad Server</h1>
<ul class="simple">
<li>Gather information about client</li>
<li>Choose an ad</li>
<li>Log impression data</li>
<li>Log click data, redirection</li>
</ul>
</div>
<div class="slide" id="gathering-client-info">
<h1>Gathering Client Info</h1>
<ul class="simple">
<li>Mostly client-side Flash code</li>
<li>SharedObject (like cookies)</li>
<li>Feeds targeting decisions for ad choice</li>
</ul>
</div>
<div class="slide" id="choose-an-ad">
<h1>Choose an ad</h1>
<ul class="simple">
<li>Fold over in-memory data structure</li>
<li>Filter out ads that don't match targeting info</li>
<li>Weight the rest</li>
<li>Choose a random number; 0 &lt;= N &lt; sum(Weights)</li>
</ul>
</div>
<div class="slide" id="log-impression-data">
<h1>Log impression data</h1>
<ul class="simple">
<li>Validation</li>
<li>Stream to hourly disk log</li>
<li>Increment counters in RAM db</li>
</ul>
</div>
<div class="slide" id="log-click-data">
<h1>Log click data</h1>
<ul class="simple">
<li>Validation</li>
<li>Stream to hourly disk log</li>
<li>Increment counters in RAM db</li>
<li>Redirect (HTTP 302) to destination URL</li>
</ul>
</div>
<div class="slide" id="cheap-tricks">
<h1>Cheap Tricks</h1>
<ul class="simple">
<li>Ad request data in URL</li>
<li>Long-term state in SharedObject</li>
</ul>
</div>
<div class="slide" id="short-term-feedback-loop">
<h1>Short-term Feedback Loop</h1>
<ul class="simple">
<li>Client state</li>
<li>RAM db counters from previous serves that day</li>
</ul>
</div>
<div class="slide" id="analytics-feedback-loop">
<h1>Analytics Feedback Loop</h1>
<ul class="simple">
<li>ETL processes adjust per hour</li>
<li>Campaign weights, budget adjustments, etc.</li>
</ul>
</div>
<div class="slide" id="lessons-learned-part-1">
<h1>Lessons Learned (part 1)</h1>
<ul class="simple">
<li>Network partitioning sucks</li>
<li>Network partitioning sucks</li>
<li>Network partitioning sucks</li>
</ul>
</div>
<div class="slide" id="lessons-learned-part-2">
<h1>Lessons Learned (part 2)</h1>
<ul class="simple">
<li>pg2 is broken</li>
<li>mnesia is too slow (for us)</li>
<li>Inter-node distribution protocol can be flaky</li>
<li>Erlang open source not always robust</li>
<li>Lists are not a good data type for strings</li>
</ul>
</div>
<div class="slide" id="favorite-erlang-features">
<h1>Favorite Erlang Features</h1>
<ul class="simple">
<li>Module reloading</li>
<li>Pattern matching</li>
<li>Binaries</li>
<li>Lightweight processes</li>
<li>Concise but not cryptic</li>
</ul>
</div>
<div class="slide" id="more-erlang-at-mochi-media">
<h1>More Erlang at Mochi Media</h1>
<ul class="simple">
<li>MochiBot</li>
<li>MochiCrypt</li>
<li>MochiScore</li>
<li>IRC bot</li>
<li>SVN deployment</li>
<li>Monitoring system</li>
<li>Node discovery</li>
</ul>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.