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

Moving People with Clojure

Moving People with Clojure

At Go-Jek, one of Indonesia’s fastest growing startups, we use Clojure in production to efficiently provide courier, transport, and shopping services all over the country. In this talk we will cover our journey of rewriting and maintaining Allocation Service, core of Go-Jek business, in Clojure. This service matches the best driver from a fleet of more than 100k drivers at the rate of more than 100k bookings per hour efficiently, with only 8 machines, and the rate doubling every six months. Switching to Clojure has enabled us to ship new features at 5x speed compared to the previous (Golang) service. Through this talk we intend to share the learnings, difficulties, and motivations for the same.

Abhinav Sarkar

July 20, 2017
Tweet

More Decks by Abhinav Sarkar

Other Decks in Programming

Transcript

  1. • Indonesian transport, logistics and payments startup • First billion

    dollar startup in Indonesia • Operating in more than 25 cities with more than 300.000 motorbike and car drivers • More than 25 products, using the same fleet • Processing more than 1000 orders per second
  2. Prologue Jan 2015 App launched 800 drivers New verticals 30.000

    drivers Java monolith Go service Aug 2015
  3. Prologue Feb 2016 Business grew 200.000 drivers Rewrite starts Go

    service Clojure service Aug 2016 Rewrite ends Oct 2016 Rewrite in prod Nov 2016
  4. Why Rewrite? • Go is imperative and mutation heavy •

    Domain heavy code is hard to reason about • Moving fast is more important than high performance • Immutability, laziness and dynamic typing in Clojure • leads to simpler domain specific code
  5. Testing the Rewrite • Two weeks in testing • Duplicating

    live traffic • Feature toggles • Mock downstream services • Match data and external effects
  6. Duplicate Traffic Live Traffic Shared Services Actual Services Mock Services

    Toggled-off Services Go Allocation Service Clojure Allocation Service OMSes
  7. Releasing the Rewrite • AOT compiled uberjar • saves startup

    time • Monitoring: application and business metrics, errors • Incremental rollout over two weeks
  8. Generative Testing • At all levels (unit, functional and integration)

    • Using test.check library • Handwritten generators
  9. • The protected function call is wrapped in a circuit

    breaker object, which monitors for failures. • Once the failures reach a certain threshold, the circuit breaker trips. • Once tripped all further calls to the circuit breaker return with an error, without the protected call being made at all. Circuit Breaker
  10. Epilogue • Around 1 new release per week • Experimentation

    • Clojure Sessions • More services in Clojure