SlideShare a Scribd company logo
Reasonable RPC
with Remotely
ScalaDays, 18th March 2015
Rúnar Bjarnason
Tim Perrett
Reasonable RPC with Remotely
Existing solutions
No panaceas. Just tradeoffs.
Monolith
• All functionality in a single binary
• Doesn’t scale
• Difficult to evolve and maintain
Broker pattern
• Message bus or broker mediates
between services
• Single point of failure/integration
• If broker goes down, the whole system
is down
Message-passing
• Lightweight and inexpensive
• Reliable and scales well
• Discovery is a pain
Message passing
solutions
• Finagle
• Thrift
• Akka
• HTTP*(JSON+XML)/REST
Finagle
• Imperative API
• No reuse
• Too powerful
• No higher-order constructs
Thrift
• All of the problems with Finagle
• Tough tooling
• Documentation is lacking
• No formal spec for wire format
Akka
• Too powerful
• Untyped
• Actor system API bleeds to the outside
• Behavior of complex systems 

is unreasonable
HTTP*(JSON+XML)/REST
• Unproductive, developer time wasted
• Marshalling/unmarshalling
• Defining HTTP endpoints and using HTTP clients
• Resources wasted on HTTP layer and parsing
• Does what we want, but at tremendous cost
Our Vision
Productivity, Safety, Reuse
Productivity
Don’t want to think about:
• HTTP protocol specifics
• Every possible failure mode
• Serialization format
• Compatibility
Safety
• Ad-hoc evolution doesn’t scale
• Incompatibilities should be compile-time
failures
• Fail as early as possible
Reuse
• Use an actual programming language
• Build protocols from modular primitives
• Compose large protocols from small ones
Remotely
RPC for reasonable people
Remotely
RPC for reasonable people
BETA
Remotely
• Pilot for Verizon open-source
• Taking the time to build exactly
what we want to use
• You can use it too!
Remote call
val x = factorial(9)
Remote reference
factorial: Remote[Int => Int]
Applying a remote
function
val x: Remote[Int] =
factorial(9)
Getting a response
val x: Response[Int] =
factorial(9).run(endpoint)
Response monad
type Demo[A] = Kleisli[Response, Endpoint, A]
implicit def remoteToK[A](r: Remote[A]): Demo[A] =
Kleisli.ask[Response, Endpoint].flatMapK(r.run)
def call: Demo[(Movie,List[Actor])] = for {
a <- MovieClient.getMovie("m2")
b <- MovieClient.getActors(a)
} yield (a,b)
Running Responses
val address = new InetSocketAddress("10.1.0.1",8080)
val exe: Task[(Movie,List[Actor])] = for {
transport <- NettyTransport.single(address)
endpoint = Endpoint.single(transport)
output <- call(endpoint)(Context.empty)
_ <- transport.shutdown
} yield output
val (movie, actors) = exe.run
Demo
Feature Pageant
Binary Codecs
• Fast, lightweight binary serialization
• Built on scodec
• Ships with codecs for standard Scala types
• Easy to make codecs for your own types
• Future goal:
Fully automate codec-creation
Pluggable transports
• Uses Netty 4 out of the box
• Akka I/O
• Netty 3
• ØMQ
Pluggable transports
type Handler =
Process[Task,BitVector] =>
Process[Task,BitVector]
Endpoints
case class Endpoint(
connections: Process[Task,Handler])
Endpoint combinators
def circuitBroken:
(Duration,Int,Endpoint) => Endpoint
def failoverChain:
(Duration,Process[Task,Endpoint]) => Endpoint
Context-passing
• Context provides arbitrary container for
experiment propagation.
• Every request tagged with a UUID.
• Contains stack of request UUIDs.
• highlights the “path” through the system
request graph when debugging.
Pluggable monitoring
• Report round-trip latency timing.
• Trace every request uniquely.
• Trace the request stack entirely.
• Bring your own by implementing
the Monitoring trait.
• Uses println out of the box.
Capability checking
• Protocol versioning over time inevitable
• Determine client/server compatibility
before establishing connection
How fast is it?
• Went from 56 ms to 32 ms

(production payload)
• In benchmarks on modest hardware
• Min: ~400 μs
• Mean: ~1.5 ms
• Throughput is an issue currently
Spray I/O Netty 4
Future work
• Prettier API
• Drastically improve throughput
• Extensible protocol language
• More built-ins for e.g. server-side
map and flatMap
• Remote polymorphic functions
Summary
• Remotely is productive
• It’s safe
• It promotes code reuse
• You can contribute!
EOF
@runarorama
@timperrett
github.com/oncue/remotely
github.com/oncue/remotely-demo

More Related Content

KEY
Scalalable Language for a Scalable Web
ODP
Developing high-performance network servers in Lisp
PDF
Mini Rails Framework
KEY
Wider than rails
PDF
Woo: Writing a fast web server @ ELS2015
PDF
The Parenscript Common Lisp to JavaScript compiler
PDF
JDD 2016 - Andrej Mihály - How To Bake Reactive Behavior Into Your Java Ee Ap...
ODP
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Scalalable Language for a Scalable Web
Developing high-performance network servers in Lisp
Mini Rails Framework
Wider than rails
Woo: Writing a fast web server @ ELS2015
The Parenscript Common Lisp to JavaScript compiler
JDD 2016 - Andrej Mihály - How To Bake Reactive Behavior Into Your Java Ee Ap...
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp

What's hot (20)

PDF
Async queue-transaction
PDF
Ansible 202 - sysarmy
PDF
Writing a fast HTTP parser
KEY
About Clack
PDF
Cachopo - Scalable Stateful Services - Madrid Elixir Meetup
PPTX
轉轉轉好運旺來一起來之雲端轉檔大作戰!
PDF
Optimize perl5 code for perfomance freaks
ODP
Http programming in play
PDF
Why and how Pricing Assistant migrated from Celery to RQ - Paris.py #2
PPTX
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
PPTX
Ansible Best Practices - July 30
PDF
Hello elixir (and otp)
KEY
Leave end-to-end testing to Capybara
PDF
Kotlin 1.2: Sharing code between platforms
PDF
Ruby HTTP clients
PPTX
Go from a PHP Perspective
PPTX
Java 8 concurrency abstractions
PDF
2021laravelconftwslides6
PDF
Apache Camel in the belly of the Docker whale
PPTX
Introduction to Ansible - Jan 28 - Austin MeetUp
Async queue-transaction
Ansible 202 - sysarmy
Writing a fast HTTP parser
About Clack
Cachopo - Scalable Stateful Services - Madrid Elixir Meetup
轉轉轉好運旺來一起來之雲端轉檔大作戰!
Optimize perl5 code for perfomance freaks
Http programming in play
Why and how Pricing Assistant migrated from Celery to RQ - Paris.py #2
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
Ansible Best Practices - July 30
Hello elixir (and otp)
Leave end-to-end testing to Capybara
Kotlin 1.2: Sharing code between platforms
Ruby HTTP clients
Go from a PHP Perspective
Java 8 concurrency abstractions
2021laravelconftwslides6
Apache Camel in the belly of the Docker whale
Introduction to Ansible - Jan 28 - Austin MeetUp
Ad

Viewers also liked (7)

PDF
Compositional I/O Stream in Scala
PDF
Beyond Mere Actors
PDF
Purely Functional I/O
PPTX
Building Enigma with State Monad & Lens
PDF
Enterprise Algebras, Scala World 2016
PDF
Large-scale Infrastructure Automation at Verizon
PDF
Peyton jones-2009-fun with-type_functions-slide
Compositional I/O Stream in Scala
Beyond Mere Actors
Purely Functional I/O
Building Enigma with State Monad & Lens
Enterprise Algebras, Scala World 2016
Large-scale Infrastructure Automation at Verizon
Peyton jones-2009-fun with-type_functions-slide
Ad

Similar to Reasonable RPC with Remotely (20)

PPTX
Real world Scala hAkking NLJUG JFall 2011
PDF
Typesafe stack - Scala, Akka and Play
PPTX
Developing distributed applications with Akka and Akka Cluster
PDF
BigQuery case study in Groovenauts & Dive into the DataflowJavaSDK
PPTX
The dark side of Akka and the remedy - bp.scala meetup
PDF
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
PDF
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
PDF
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
PDF
Reactive Web-Applications @ LambdaDays
PPTX
Kubernetes Manchester - 6th December 2018
PPTX
Exploring Twitter's Finagle technology stack for microservices
PDF
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
PDF
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
PDF
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
PPTX
Road to sbt 1.0 paved with server
PPT
The Ongoing Democratization of Robotics Development
PDF
Actors evolved- Rotem Hermon
PDF
Bucketbench: Benchmarking Container Runtime Performance
PDF
Puppet devops wdec
PDF
Stackato v2
Real world Scala hAkking NLJUG JFall 2011
Typesafe stack - Scala, Akka and Play
Developing distributed applications with Akka and Akka Cluster
BigQuery case study in Groovenauts & Dive into the DataflowJavaSDK
The dark side of Akka and the remedy - bp.scala meetup
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
Reactive Web-Applications @ LambdaDays
Kubernetes Manchester - 6th December 2018
Exploring Twitter's Finagle technology stack for microservices
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Road to sbt 1.0 paved with server
The Ongoing Democratization of Robotics Development
Actors evolved- Rotem Hermon
Bucketbench: Benchmarking Container Runtime Performance
Puppet devops wdec
Stackato v2

More from Timothy Perrett (11)

PDF
Nelson: Rigorous Deployment for a Functional World
PDF
Online Experimentation with Immutable Infrastructure
PPTX
Functional Programming at Verizon
PPTX
BRUG - Hello, Scala
PPTX
Scala Helix
PPTX
Javazone 2011: Goal Directed Web Applications
PDF
Concurrency and Parallelism with Scala
PPTX
Scaladays 2011: Task Driven Scala Web Applications
PPTX
Bathcamp 2010-riak
PPTX
Javazone 2010-lift-framework-public
PDF
Devoxx 2009: The Lift Framework
Nelson: Rigorous Deployment for a Functional World
Online Experimentation with Immutable Infrastructure
Functional Programming at Verizon
BRUG - Hello, Scala
Scala Helix
Javazone 2011: Goal Directed Web Applications
Concurrency and Parallelism with Scala
Scaladays 2011: Task Driven Scala Web Applications
Bathcamp 2010-riak
Javazone 2010-lift-framework-public
Devoxx 2009: The Lift Framework

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Approach and Philosophy of On baking technology
PDF
Modernizing your data center with Dell and AMD
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Electronic commerce courselecture one. Pdf
PPTX
Cloud computing and distributed systems.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation_ Review paper, used for researhc scholars
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
Approach and Philosophy of On baking technology
Modernizing your data center with Dell and AMD
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation theory and applications.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.

Reasonable RPC with Remotely