Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Billing the Cloud
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Pierre-Yves Ritschard
May 12, 2017
Programming
330
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Billing the Cloud
Updated billing the cloud slides for We are Developers 2017 in Vienna
Pierre-Yves Ritschard
May 12, 2017
More Decks by Pierre-Yves Ritschard
See All by Pierre-Yves Ritschard
Meetup Camptocamp: Exoscale SKS
pyr
0
580
The (long) road to Kubernetes
pyr
0
340
From vertical to horizontal: The challenges of scalability in the cloud
pyr
0
100
Change Management at Scale
pyr
0
160
5 years of Clojure
pyr
2
1.1k
Taming Jenkins
pyr
0
77
Init: then and now
pyr
1
240
From Vertical to Horizontal
pyr
2
170
Billing the Cloud
pyr
7
2.4k
Other Decks in Programming
See All in Programming
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
7k
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
210
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
400
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
110
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.7k
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
11
5.9k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
260
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
660
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.3k
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
410
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
140
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
370
Featured
See All Featured
Balancing Empowerment & Direction
lara
6
1.2k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
First, design no harm
axbom
PRO
2
1.2k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
170
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
The Language of Interfaces
destraynor
162
27k
30 Presentation Tips
portentint
PRO
1
330
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Statistics for Hackers
jakevdp
799
230k
Design in an AI World
tapps
1
250
Transcript
@pyr Billing the cloud Real world stream processing
@pyr Three-line bio • CTO & co-founder at Exoscale •
Open Source Developer • Monitoring & Distributed Systems Enthusiast
@pyr Billing the cloud Real world stream processing
@pyr • Billing resources • Scaling methodologies • Our approach
@pyr
@pyr provider "exoscale" { api_key = "${var.exoscale_api_key}" secret_key = "${var.exoscale_secret_key}"
} resource "exoscale_instance" "web" { template = "ubuntu 17.04" disk_size = "50g" template = "ubuntu 17.04" profile = "medium" ssh_key = "production" }
None
None
@pyr Infrastructure isn’t free! (sorry)
@pyr Business Model • Provide cloud infrastructure • (???) •
Profit!
None
None
@pyr 10000 mile high view
None
Quantities
Quantities • 10 megabytes have been set from 159.100.251.251 over
the last minute
Resources
Resources • Account WAD started instance foo with profile large
today at 12:00 • Account WAD stopped instance foo today at 12:15
A bit closer to reality {:type :usage :entity :vm :action
:create :time #inst "2016-12-12T15:48:32.000-00:00" :template "ubuntu-16.04" :source :cloudstack :account "geneva-jug" :uuid "7a070a3d-66ff-4658-ab08-fe3cecd7c70f" :version 1 :offering "medium"}
A bit closer to reality message IPMeasure { /* Versioning
*/ required uint32 header = 1; required uint32 saddr = 2; required uint64 bytes = 3; /* Validity */ required uint64 start = 4; required uint64 end = 5; }
@pyr Theory
@pyr Quantities are simple
None
@pyr Resources are harder
None
@pyr This is per account
None
@pyr Solving for all events
resources = {} metering = [] def usage_metering(): for event
in fetch_all_events(): uuid = event.uuid() time = event.time() if event.action() == 'start': resources[uuid] = time else: timespan = duration(resources[uuid], time) usage = Usage(uuid, timespan) metering.append(usage) return metering
@pyr In Practice
@pyr • This is a never-ending process • Minute-precision billing
• Applied every hour
@pyr • Avoid overbilling at all cost • Avoid underbilling
(we need to eat!)
@pyr • Keep a small operational footprint
@pyr A naive approach
30 * * * * usage-metering >/dev/null 2>&1
None
@pyr Advantages
@pyr • Low operational overhead • Simple functional boundaries •
Easy to test
@pyr Drawbacks
@pyr • High pressure on SQL server • Hard to
avoid overlapping jobs • Overlaps result in longer metering intervals
You are in a room full of overlapping cron jobs.
You can hear the screams of a dying MySQL server. An Oracle vendor is here. To the West, a door is marked “Map/Reduce” To the East, a door is marked “Stream Processing”
> Talk to Oracle
You’ve been eaten by a grue.
> Go West
@pyr
@pyr • Conceptually simple • Spreads easily • Data locality
aware processing
@pyr • ETL • High latency • High operational overhead
> Go East
@pyr
@pyr • Continuous computation on an unbounded stream • Each
record processed as it arrives • Very low latency
@pyr • Conceptually harder • Where do we store intermediate
results? • How does data flow between computation steps?
@pyr Deciding factors
@pyr Our shopping list • Operational simplicity • Integration through
our whole stack • Room to grow
@pyr Operational simplicity • Experience matters • Spark and Storm
are intimidating • Hbase & Hive discarded
@pyr Integration • HDFS & Kafka require simple integration •
Spark goes hand in hand with Cassandra
@pyr Room to grow • A ton of logs •
A ton of metrics
@pyr Small confession • Previously knew Kafka
@pyr
None
@pyr • Publish & Subscribe • Processing • Store
@pyr Publish & Subscribe • Records are produced on topics
• Topics have a predefined number of partitions • Records have a key which determines their partition
@pyr • Consumers get assigned a set of partitions •
Consumers store their last consumed offset • Brokers own partitions, handle replication
None
@pyr • Stable consumer topology • Memory disaggregation • Can
rely on in-memory storage • Age expiry and log compaction
@pyr
@pyr Billing at Exoscale
None
None
None
@pyr Problem solved?
@pyr • Process crashes • Undelivered message? • Avoiding overbilling
@pyr Reconciliation • Snapshot of full inventory • Converges stored
resource state if necessary • Handles failed deliveries as well
@pyr Avoiding overbilling • Reconciler acts as logical clock •
When supplying usage, attach a unique transaction ID • Reject multiple transaction attempts on a single ID
@pyr Avoiding overbilling • Reconciler acts as logical clock •
When supplying usage, attach a unique transaction ID • Reject multiple transaction attempts on a single ID
@pyr Parting words
@pyr Looking back • Things stay simple (roughly 600 LoC)
• Room to grow • Stable and resilient • DNS, Logs, Metrics, Event Sourcing
@pyr What about batch? • Streaming doesn’t work for everything
• Sometimes throughput matters more than latency • Building models in batch, applying with stream processing
@pyr Thanks! Questions?