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

Clojure Ireland Talk June 2015

Clojure Ireland Talk June 2015

Brief rundown of some Netflix libraries we've found useful when rolling out new backend services at Logentries.

Chris Mowforth

June 03, 2015
Tweet

More Decks by Chris Mowforth

Other Decks in Programming

Transcript

  1. LOGENTRIES • Founded in ’10 • Massive growth: • Customer

    base • Volume sent • Volume searched Now we have to make it scale!
  2. LATER ON Log processing infrastructure Web Tier (Java) (Django/JS) Browser

    Service x (JVM-based) Service y (JVM-based) Service ? (JVM-based) We went hiring :)
  3. LATER STILL… We got some dev-ops guys Log processing infrastructure

    Web Tier (Java) (Django/JS) Browser Service x (JVM-based) Service y (JVM-based) Service ? (JVM-based) Magic continuous-delivery system
  4. CONSTRAINTS 1. Avoid new services incurring
 excessive ops burden 2.

    Minimise engineering time spent
 developing non-essential* IP
  5. NON-ESSENTIAL? People value us for: • Reliable log ingestion •

    Real-time alerts • Simple, expressive query language • Extending our analytics capabilities
  6. NON-ESSENTIAL? This is critical, but not what we’re
 valued for:


    • Configuration • Load-balancing • Fault-tolerance (bulkheading) • Metrics & monitoring • Routing, production debugging, TiP
  7. ARCHAIUS Take config from anywhere: • Environment vars • Properties

    file on disk • File at URL • ZooKeeper • JMX • etcd • …
  8. ARCHAIUS “Can we schedule some downtime to change value x?”

    private static final int TIMEOUT = 1000;
  9. ARCHAIUS “Nah, we can just change it.” private static final

    DynamicIntProperty TIMEOUT = DynamicPropertyFactory
 .getInstance()
 .getIntProperty("service.timeout", 1000); TIMEOUT.addCallback(() ->
 System.out.println("value changed!"));
  10. RxJava "ReactiveX is a combination of the best ideas from

    the Observer pattern, the Iterator pattern, and functional programming" http://reactivex.io/
  11. RxJava Async by default. Even if it’s not :) public

    interface TagService { List<Tag> getTags(UUID accountId); }
  12. RxJava Async by default. List<Tag> tags = tagService.getTags("5bd8bda8-b2ae-4d83- a20f-50a5327a4a13"); List<Tag>

    publicTags = new ArrayList<>(); for (Tag tag : tags) { if (!tag.isPrivate()) { publicTags.add(tag); } }
  13. RxJava Async by default. (defn rx-fn [fn] (reify Func1 (call

    [this obj] (fn obj)))) (defn rx-action [fn] (reify Action1 (call [this e] (fn e)))) (-> (.getTags tagService "5bd8bda8-b2ae-4d83-a20f-50a5327a4a13") (.filter (rx-fn #(not (.isPrivate %)))) (.subscribe (rx-action #(println (.getId %)))))
  14. HYSTRIX Bulkheading: • Mock responses- sometimes it's ok • Just

    die- no point burning a thread if 
 it'll fail anyway
  15. HYSTRIX class SomeServiceRequest extends HystrixRequest<String> { @Override public String run()

    throws Exception { // some fallible API call } @Override public String getFallback() { // return some stale data, if viable } }
  16. END