A minimal set of slides used to present an overview of Finagle, an RPC library built atop Netty
@TwitterAds | ConfidentialEvan Meagher (@evanm)7/28/14Netty at Twitter with Finagle
View Slide
@Twitter 2AgendaWhy and what is Finagle?What does it do?What are we working on now?
@Twitter 3What is Finagle?
@Twitter 4An open source, protocol-agnostic,asynchronous RPC library for the JVM
@Twitter 5Why did we build Finagle?
@Twitter 6In the beginning…
@Twitter 7Monolithic Rails appMySQL
@Twitter 8MonolithicRails appMySQLMonolithicRails appMySQLMonolithicRails appMySQL… MonolithicRails appMySQL……
@Twitter 9
@Twitter 10
@Twitter 11What is Finagle?
@Twitter 12An open source, protocol-agnostic,asynchronous RPC library for the JVM
@Twitter 13An open source, protocol-agnostic,asynchronous RPC library for the JVM
@Twitter 14An open source, protocol-agnostic,asynchronous RPC library for the JVM
@Twitter 15An open source, protocol-agnostic,asynchronous RPC library for the JVM
@Twitter 16An open source, protocol-agnostic,asynchronous RPC library for the JVM
@Twitter 17What does Finagle do?
@Twitter 18Standardizes the edges in a “boxes andarrows” network diagram
@Twitter 19[1] http://monkey.org/~marius/funsrv.pdf
@Twitter 20type Service[Req, Rep] = Req => Future[Rep]
@Twitter 21type Service[Req, Rep] = Req => Future[Rep]ServerClientReqFuture[Rep]
@Twitter 22A contrived example
@Twitter 23val server = new Service[HttpReq, HttpRep] {def apply(req: HttpReq): Future[HttpRep] =Future.value(HttpRep(Status.OK, req.body))}!Http.serve(":80", server)
@Twitter 24val client: Service[HttpReq, HttpRep] =Http.newService(“twitter.com:80")!val futureResponse: Future[HttpRep] =client(HttpReq(“/"))!futureResponse map { response =>println(response)}
@Twitter 25Now let’s say you need toauthenticate requests
@Twitter 26type Service[Req, Rep] = Req => Future[Rep]!type Filter[Req, Rep] =(Req, Service[Req, Rep]) => Future[Rep]
@Twitter 27type Service[Req, Rep] = Req => Future[Rep]!type Filter[Req, Rep] =(Req, Service[Req, Rep]) => Future[Rep]Filter Filter ServerClient
@Twitter 28def isAuthed(req: Req): Booleanval authFilter: Filter[HttpReq, HttpRes] = {(req, svc) =>if (isAuthed(req)) svc(req)else Future.exception(new AccessDenied)}!val authedServer: Service[HttpReq, HttpRes] =authFilter andThen server
@Twitter 29val instrumentedServer = authFilterandThen traceRequestandThen recordStatsandThen server
@Twitter 30What are we working on now?
@Twitter 31Service discoverySee the “Names” page on the Finagle user guide:http://twitter.github.io/finagle/guide/Names.html!val client = Http.newService(“zk!myzkhost.mycompany.com:2181!/my/zk/path”)
@Twitter 32Load balancing
@Twitter 33Request multiplexingSee the “Protocols” page on the Finagle user guide:http://twitter.github.io/finagle/guide/Protocols.html
@Twitter 34Tail-latency optimization
@TwitterAds | ConfidentialThanks!github.com/twitter/finagle@finagle@evanm