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

Lessons Learned : Improving Performance and Res...

Jaya Frandy
November 28, 2017

Lessons Learned : Improving Performance and Resilience in Blibli.com Store Front

Slides from our talk about our journey in increasing performance using completable future, guava, and rx java at JVM Meetup #9 & Tech It Easy @ Blibli.com

Download the PDF for clickable links!

Jaya Frandy

November 28, 2017
Tweet

Other Decks in Technology

Transcript

  1. Disclaimer Presentations are intended for educational purposes only and not

    to replace independent professional judgment. Statements of facts, views, opinions expressed do not necessarily reflect those of Blibli.com
  2. Outline • Introduction • Performance Methodology • Implement CompletableFuture Java

    8 • Implement Guava Cache • Implement RxJava • Result
  3. Profiling using XRebel • How we do – Narrow Profiling

    to specific end point that we want to improve – Identify which services that blocking / problematic • Possible Solution : – Move some services that high load to ajax – Make some services to asynchronous – Caching some services that high load – Make thread separated from tomcat
  4. Multiple Services Call Problem Problem : • Multiple information taken

    from multiple services • Each service can take some time to give response Solution : • Make those service call (independent from other services) asynchronous using CompletableFuture
  5. Completable Future A stage of a possibly asynchronous computation, that

    performs an action or computes a value when another CompletionStage completes. - Java documentation Completion Stage
  6. Completable Future A Future that may be explicitly completed (setting

    its value and status), and may be used as a CompletionStage, supporting dependent functions and actions that trigger upon its completion. - Java documentation Completable Future
  7. High Load Problem to Backend Service Problem : • Store

    front serve content mainly from service • High response time during high concurrent request to backend services (cms, etc) • Mostly same content Solution : • Cache it using Guava!
  8. Guava Cache Guava cache is a part of google guava

    core library and it provide an in memory cache. Why Guava cache ? - It provide us interface to populate cache and its behavior - We are willingly to spend our memory to improve the speed - We have many keys that called repetitively
  9. Guava Cache • Pros – Improve speed – No need

    to execute same process with exact parameters – No need for network connection – Can handle huge content – Can handle complex cache key • Cons – Consume RAM – Local Cache, duplicate between nodes
  10. Guava Cache Refresh • Different from eviction • Refreshing a

    key loads a new value for the key, possibly asynchronously • The old value (if any) is still returned while the key is being refreshed • If an exception is thrown while refreshing, the old value is kept, and the exception is logged and swallowed
  11. Guava Cache Refresh • Pros – Return old value immediately

    and refresh a new value asynchronously – Keep the old value when refreshing fails • Cons – Not getting the newest value even the time expires (need to wait the refresh to successfully retrieve new value) – Value will always remain on RAM
  12. Result - Our content API and search API are protected

    from high request - Blibli.com store front application resilience is improved. - Same repeated request doesn’t need to call the services
  13. RxJava Implementation Problem : • High load + Slow Response

    = Out of Thread Solution : • Wrap the request using Rx
  14. Published Paper • Conference RAIEIC 2017 at Nov 21st •

    Lessons Learned In Applying Reactive Systems