Netty at Twitter with Finagle

Netty at Twitter with Finagle

A minimal set of slides used to present an overview of Finagle, an RPC library built atop Netty

2a8171b6c385b865e30bf070cf588329?s=128

Evan Meagher

July 29, 2014
Tweet

Transcript

  1. 2.

    @Twitter 2 Agenda Why and what is Finagle? What does

    it do? What are we working on now?
  2. 8.

    @Twitter 8 Monolithic Rails app MySQL Monolithic Rails app MySQL

    Monolithic Rails app MySQL … Monolithic Rails app MySQL … …
  3. 23.

    @Twitter 23 val server = new Service[HttpReq, HttpRep] { def

    apply(req: HttpReq): Future[HttpRep] = Future.value(HttpRep(Status.OK, req.body)) } ! Http.serve(":80", server)
  4. 24.

    @Twitter 24 val client: Service[HttpReq, HttpRep] = Http.newService(“twitter.com:80") ! val

    futureResponse: Future[HttpRep] = client(HttpReq(“/")) ! futureResponse map { response => println(response) }
  5. 26.

    @Twitter 26 type Service[Req, Rep] = Req => Future[Rep] !

    type Filter[Req, Rep] = (Req, Service[Req, Rep]) => Future[Rep]
  6. 27.

    @Twitter 27 type Service[Req, Rep] = Req => Future[Rep] !

    type Filter[Req, Rep] = (Req, Service[Req, Rep]) => Future[Rep] Filter Filter Server Client
  7. 28.

    @Twitter 28 def isAuthed(req: Req): Boolean val authFilter: Filter[HttpReq, HttpRes]

    = { (req, svc) => if (isAuthed(req)) svc(req) else Future.exception(new AccessDenied) } ! val authedServer: Service[HttpReq, HttpRes] = authFilter andThen server
  8. 31.

    @Twitter 31 Service discovery See 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” )
  9. 33.

    @Twitter 33 Request multiplexing See the “Protocols” page on the

    Finagle user guide: http://twitter.github.io/finagle/guide/Protocols.html