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

Scaling out a Rails app with Scala and Finagle

Avatar for stephbian stephbian
November 12, 2016

Scaling out a Rails app with Scala and Finagle

A lot of startups use Ruby on Rails for fast development, which makes sense -- it’s great for building CRUD apps quickly and cheaply. But building your app with Rails has it’s own drawbacks: it can get huge and messy, runtime is slow, and concurrency is an afterthought. While that shouldn’t stop you from using the framework, it’s important to think about longterm scalability during development. At Brigade, we have been developing a social network for politics using Rails. However, with time and more users, we decided to migrate more complex and modular realtime computations to Finagle micro-services. This talk will discuss the technolgies we selected (Scala, Finagle, Thrift) and how we addressed issues of debuggability, data-access, and integrating in various environments.

Avatar for stephbian

stephbian

November 12, 2016

Other Decks in Technology

Transcript

  1. Ruby on Rails • Pros ◦ Quick development ◦ ActiveRecord

    ◦ Community • Cons ◦ Performance doesn’t compare to JVM ◦ Lack of concurrency ◦ Ruby
  2. Why Scala? • JVM performance • Support for asynchronous calls

    and computation • Static typing • Existing Scala components and experience
  3. Protocol: Thrift • Acts as agreement between client and server

    • No ambiguity over request/response structure
  4. Data-access Complexity • Rails uses ActiveRecord to manage database •

    How do microservices get data when Rails owns the schema?
  5. • How do engineers develop and test? • Abstract two

    strategies ◦ MySQL Strategy ◦ Service Strategy • AllServer which runs all microservices in a single JVM • Developed Dock to define, build, and run container with all dependencies Integration across environments
  6. Summary • Finagle provides a simple RPC framework • Thrift

    enforces request and response structure • Debuggability with HTTP endpoints • Data-access via event-driven architecture • Integration using different strategies and easy to use tools
  7. Thanks! • “10,000 times faster than MySQL?” • Check out

    Dock: http://github.com/brigade/dock • Check out Brigade: http://brigade.com • Follow me on Twitter: @stephbian