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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Moses Nakamura
February 19, 2014
Technology
1.1k
4
Share
Finagle Overview
Finagle Overview presented to the NY Scala Meetup
Moses Nakamura
February 19, 2014
Other Decks in Technology
See All in Technology
JEP 522 Deep Dive - G1 GC同期コスト削減によるスループット向上を徹底検証&解説
tabatad
1
640
Terraformモジュールは、なぜ「魔境」化するのか
hayama17
1
160
Sony_KMP_Journey_KotlinConf2026
sony
2
200
Strands Agents超入門
kintotechdev
1
160
運用を見据えたAIエージェント設計実践
amacbee
0
1.9k
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
4
1.8k
「コーディング」しない人のための Claude Code 入門 ChatGPT の次の一歩 — 業務に組み込む 育成・共有・自動化
rfdnxbro
2
1.1k
コードレビューを制するチームがソフトウェアデリバリーのフローを制す / Beyond Code Review: Distributing Its Responsibilities Across the SDLC
mtx2s
3
710
Spring Boot における AOT Cache 活用テクニックと 起動時間改善事例
ntt_dsol_java
0
200
Java正規表現エンジン(NFA)の仕組みと パフォーマンスを維持するための最適化手法
takeuchi_132917
0
170
long-running-tasks
cipepser
3
460
Diagnosing performance problems without the guesswork
elenatanasoiu
0
150
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
950
The Pragmatic Product Professional
lauravandoore
37
7.3k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
930
Code Reviewing Like a Champion
maltzj
528
40k
GraphQLとの向き合い方2022年版
quramy
50
15k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
260
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Rails Girls Zürich Keynote
gr2m
96
14k
Docker and Python
trallard
47
3.9k
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]