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
Finagle Overview
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Moses Nakamura
February 19, 2014
Technology
4
1.1k
Finagle Overview
Finagle Overview presented to the NY Scala Meetup
Moses Nakamura
February 19, 2014
Tweet
Share
Other Decks in Technology
See All in Technology
予期せぬコストの急増を障害のように扱う――「コスト版ポストモーテム」の導入とその後の改善
muziyoshiz
1
1.8k
生成AIを活用した音声文字起こしシステムの2つの構築パターンについて
miu_crescent
PRO
2
190
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
250
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
210
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.7k
OWASP Top 10:2025 リリースと 少しの日本語化にまつわる裏話
okdt
PRO
3
650
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
42k
Context Engineeringが企業で不可欠になる理由
hirosatogamo
PRO
3
560
モダンUIでフルサーバーレスなAIエージェントをAmplifyとCDKでサクッとデプロイしよう
minorun365
4
180
Kiro IDEのドキュメントを全部読んだので地味だけどちょっと嬉しい機能を紹介する
khmoryz
0
180
20260208_第66回 コンピュータビジョン勉強会
keiichiito1978
0
120
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
1
350
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
300
Visualization
eitanlees
150
17k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Tell your own story through comics
letsgokoyo
1
810
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
170
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
57
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
410
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
Being A Developer After 40
akosma
91
590k
Transcript
Finagle
Hello!
Finagle Extensible RPC Implement a feature once => get the
feature in every service => get the feature in every protocol
Twitter Futures trait Future[+A] { def map[B](fn: A => B):
Future[B] def flatMap[B](fn: A => Future[B]): Future[B] def rescue[B](fn: PartialFunction[Throwable, Future [B]]): Future[B] def handle[B](fn: PartialFunction[Throwable, B]): Future [B] }
Twitter Futures Interrupts Maintain context Scheduler
Finagle Abstractions Service Server Client
Service trait Service[-Req, +Rep] extends (Req => Future[Rep])
Server trait Server[Req, Rep] { def serve( addr: SocketAddress, underlying:
Service[Req, Rep] ): ListeningServer }
Client trait Client[Req, Rep] { def newService( dest: Name, label:
String ): Service[Req, Rep] }
None
Load Balancing Load balances to the least loaded Internally organized
as a heap Implicitly sends more requests to faster servers
Liveness
Failure Accrual After X failures in a row, backoff for
duration Y
Rolling Restart Support If we can’t establish a connection to
a host, blackhole it and try to reestablish in the background “Fail Fast”
Connection Pooling Tunable parameters: Low Watermark High Watermark Idle Timeout
Max Waiters
Stats Collection We collect stats on every request, including histograms
of request latency, success rate etc. See: Metrics, Metrics Everywhere (codahale)
Distributed Tracing Hackweek project inspired by Dapper Sample a small
number of requests Lets you see which upstreams are pummeling your service during an incident Profiling is good for debugging average latency Tracing is good for debugging long tail latency
None
Pipelining Redis Memcached
Service Discovery trait ListeningServer { def announce(addr: String): Future[Announcement] }
Service Discovery ZK internally Other schemes Adding finagle-serversets to your
classpath enables ZK
Next?!
finagle 6 apis ClientBuilder => Protocol.new Cargo Culting :( Finagle
notoriously hard to configure Zero configuration! Works out of the box.
old style val client: Service[HttpRequest, HttpResponse] = ClientBuilder() .codec(Http()) .hosts(address)
.hostConnectionLimit(1) .tcpConnectTimeout(50.milliseconds) .failFast(true) .daemon(true) .retries(3) .trace(ZipkinTracer.mk(host, port) .build()
finagle 6 style Http.newService(name, label)
mux A new protocol, layered on other protocols cf. thrift-mux
mux discard leasing multiplexing error encoding ping drain initialization
error encoding Means you can handle errors separately by just
reading the first byte Easy to imagine dropping errors, or minimizing copies etc
init + ping True liveness No more failfast or failure
accrual
draining Signals that a server will start draining Client knows
to stop sending new requests
multiplexing Pipelining for everyone! Connection pooling mostly disappears
discard No longer care about response Current world: close connection
Biggest cause of connection churn New world: send a discard request
leasing First target: GC avoidance Useful elsewhere too
Finagle Resources twitter.github.io/finagle finaglers@google groups
Work on Finagle github.com/twitter/finagle Docs! Github Issues!
Thanks! twitter: @mnnakamura github: mosesn email:
[email protected]
Work for Twitter! https://twitter.com/jobs We’re hiring! t.co/nymeetup
Questions? https://twitter.com/jobs/engineering t.co/nymeetup email:
[email protected]