Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Finagle 最新事情 #kwkni_scala

Finagle 最新事情 #kwkni_scala

Finagle 最新事情(「怖くないScala勉強会」LT 発表、2013/10/19)

http://connpass.com/event/3420/

Keyword: Scala, Netty, Finagle

Yuta Okamoto

October 19, 2013
Tweet

More Decks by Yuta Okamoto

Other Decks in Technology

Transcript

  1. Finagle ࠷৽ࣄ৘
    Ԭຊ ༤ଠ (@okapies)

    View full-size slide

  2. શࠃ 100 ສਓͷ
    Finagle Ϣʔβͷ
    Έͳ͞Μʂ

    View full-size slide

  3. Ԭຊ ༤ଠ (@okapies)
    Scala ؔ࿈ࢿྉͷ຋༁Λ͍͔ͭ͘΍ͬͯ·͢
    “Effective Scala” (http://twitter.github.io/effectivescala/index-
    ja.html)
    “໋ྩܕͷίʔϧόοΫɺؔ਺ܕͷϓϩϛε” (https://
    gist.github.com/okapies/5354929)
    "Cake Pattern: The Bakery from the Black Lagoon" (http://
    okapies.hateblo.jp/entry/2013/07/15/232456)
    ”Scala Conference in Japan 2013” ελοϑ

    View full-size slide

  4. Apache Kafka

    View full-size slide

  5. finagle-kafka

    View full-size slide

  6. Q. Finagle ͬͯ
    ͍·
    Ͳ͏ͳͬͯΔͷʁ

    View full-size slide

  7. ࠷৽൛: 6.7.1
    Netty 4 ରԠ
    ৽ Client/Server API (from v6)
    ෼͔ͬͯΔ͜ͱ

    View full-size slide

  8. Netty 4 ରԠ

    View full-size slide

  9. https://blog.twitter.com/2013/netty-4-at-twitter-reduced-gc-overhead

    View full-size slide

  10. Netty ίϛϡχςΟͱີʹ࿈ܞͯ͠ੑೳվળ
    Event Object ഇࢭɻAPI ͕ v3 ͱඇޓ׵ʹ
    Buffer Pool ͰϝϞϦׂ౰ΛࣗલͰ؅ཧ
    㱺 GC ස౓͕ 1/5 ʹɻϝϞϦଳҬ෯ͷফඅΛ 50% ࡟ݮɻ

    View full-size slide

  11. Finagle on Netty 4?

    View full-size slide

  12. ࠷ۙ Netty 3 ͔Βͷ decouple Λ΍ͬͨ
    ࢼͯ͠Έ͍ͨͳΒ DefaultClient ͱ DefaultServer ݟΕ

    View full-size slide

  13. ৽ Client/Server API

    View full-size slide

  14. v6 ϦϦʔε͔࣌Βਫ໘ԼͰίπίπ΍ͬͯͨͬΆ͍
    ·ͩਖ਼ࣜʹ͸ެ։͞Εͯͳ͍͕ɺ΋͏৮ΕΔঢ়ଶ
    API ͸·ͩ·ͩྲྀಈతʁ

    View full-size slide

  15. // Old API
    val cli: Service[HttpRequest, HttpResponse] =
    ClientBuilder()
    .codec(Http())
    .hosts(new InetSocketAddress(8080))
    .hostConnectionLimit(1)
    .build()
    val req = new DefaultHttpRequest(
    HttpVersion.HTTP_1_1, HttpMethod.GET, "/")
    val res: Future[HttpResponse] = cli(req)

    View full-size slide

  16. // New API!
    val cli: Service[HttpRequest, HttpResponse] =
    Http.newService("localhost:8080")
    val req = new DefaultHttpRequest(
    HttpVersion.HTTP_1_1, HttpMethod.GET, "/")
    val res: Future[HttpResponse] = cli(req)

    View full-size slide

  17. ϩʔυόϥϯε΍ίωΫγϣϯϓʔϧΛ࣮૷ࡁ
    Codec ͷࢦఆ͸͜ͷ΁Μ

    View full-size slide

  18. Client ʹ mix-in ͢Δ
    Richʢ͜Θ͘ͳ͍ʣAPI Λఏڙ

    View full-size slide

  19. http://twitter.github.io/finagle/guide/

    View full-size slide