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
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
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
プロポーザルに込める段取り八分
shoheimitani
1
210
20260208_第66回 コンピュータビジョン勉強会
keiichiito1978
0
110
GSIが複数キー対応したことで、俺達はいったい何が嬉しいのか?
smt7174
3
150
[CV勉強会@関東 World Model 読み会] Orbis: Overcoming Challenges of Long-Horizon Prediction in Driving World Models (Mousakhan+, NeurIPS 2025)
abemii
0
110
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
1
350
AzureでのIaC - Bicep? Terraform? それ早く言ってよ会議
torumakabe
1
520
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
0
880
Context Engineeringの取り組み
nutslove
0
330
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
150
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.4k
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
590
Featured
See All Featured
How to Talk to Developers About Accessibility
jct
2
130
Raft: Consensus for Rubyists
vanstee
141
7.3k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
A Soul's Torment
seathinner
5
2.2k
KATA
mclloyd
PRO
34
15k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
110
Chasing Engaging Ingredients in Design
codingconduct
0
110
Making the Leap to Tech Lead
cromwellryan
135
9.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
The untapped power of vector embeddings
frankvandijk
1
1.6k
YesSQL, Process and Tooling at Scale
rocio
174
15k
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]