Slide 1

Slide 1 text

OPTIMIZING BLIBLI EKO KURNIAWAN KHANNEDY

Slide 2

Slide 2 text

OPTIMIZING BLIBLI AGENDA ▸ Optimizing Blibli Page Render ▸ Optimizing Blibli Search

Slide 3

Slide 3 text

OPTIMIZING BLIBLI PAGE RENDER OPTIMIZING BLIBLI

Slide 4

Slide 4 text

OPTIMIZING BLIBLI BLIBLI

Slide 5

Slide 5 text

OPTIMIZING BLIBLI BLIBLI ▸ Reload Page every time customer click link. ▸ Using ajax for paging.

Slide 6

Slide 6 text

PJAX PUSHSTATE + AJAX

Slide 7

Slide 7 text

OPTIMIZING BLIBLI WHAT IS PJAX ▸ PJAX is combination of PushState and AJAX to deliver a fast browsing experience with real permalinks, page titles, and a working back button.

Slide 8

Slide 8 text

OPTIMIZING BLIBLI HOW PJAX WORKS? ▸ PJAX works by grabbing html from your server via ajax and replacing the content of a container on your page with the ajax'd html. ▸ It then updates the browser's current URL using pushState without reloading your page's layout or any resources (JS, CSS), giving the appearance of a fast, full page load. ▸ But really it's just ajax and pushState.

Slide 9

Slide 9 text

OPTIMIZING BLIBLI HOW PJAX WORKS? SERVER Ajax Request HTML Body Content

Slide 10

Slide 10 text

OPTIMIZING BLIBLI HOW IS PJAX FASTER THAN NORMAL PAGE RELOAD? ▸ Save on the overhead of fetching/parsing CSS and JS on each page load. ▸ Browser doesn't have to parse all the JS again. ▸ This feels a lot like SPA but works without the complexity of an SPA.

Slide 11

Slide 11 text

OPTIMIZING BLIBLI IMPLEMENTING PJAX (CLIENT SIDE + JQUERY) ▸ https://github.com/defunkt/jquery-pjax $(document).pjax('a', '#pjax-container')

Slide 12

Slide 12 text

OPTIMIZING BLIBLI IMPLEMENTING PJAX (SERVER SIDE) if request.headers['X-PJAX'] render :layout => false end

Slide 13

Slide 13 text

OPTIMIZING BLIBLI WHO IS USING PJAX?

Slide 14

Slide 14 text

OPTIMIZING BLIBLI WHO IS USING PJAX?

Slide 15

Slide 15 text

OPTIMIZING BLIBLI WHO IS USING PJAX?

Slide 16

Slide 16 text

OPTIMIZING BLIBLI SEARCH ELASTICSEARCH & MARVEL

Slide 17

Slide 17 text

OPTIMIZING BLIBLI BLIBLI SEARCH

Slide 18

Slide 18 text

OPTIMIZING FRONTEND OPTIMIZING BLIBLI SEARCH

Slide 19

Slide 19 text

OPTIMIZING BLIBLI FACET/AGGREGATION PROBLEM ▸ Facet/Aggregation is SLOW, use it wisely. ▸ Query time with facet/aggregation is 3-10 times slower than without facet/ aggregation. ▸ Currently in Blibli, we are using facet/aggregation in all search page.

Slide 20

Slide 20 text

OPTIMIZING BLIBLI REMOVE FACET/AGGREGATION IN PAGING ▸ Every time customer change page in search result. We fetch search result and all facet/aggregation via ajax. ▸ https://www.blibli.com/ajax-search ▸ Actually we don’t need facet/aggregation result if only change page ▸ https://www.blibli.com/ajax-search?aggregation=false

Slide 21

Slide 21 text

OPTIMIZING BLIBLI PARTIAL FACET/AGGREGATION ▸ In Blibli, every times customer filter facet/aggregation, We will reload all search result and aggregation. ▸ But, we still using old facet for selected filter. ▸ https://www.blibli.com/ajax-search?brand=Acer&aggregation_brand=false

Slide 22

Slide 22 text

OPTIMIZING BACKEND OPTIMIZING BLIBLI SEARCH

Slide 23

Slide 23 text

OPTIMIZING BLIBLI CURRENT BLIBLI SOLR (MASTER - SLAVE) ▸ Currently Blibli using 8 Solr Server for Search. ▸ Master - Slave Replication. ▸ No Shard. ▸ Workload distribution only using Load Balancer.

Slide 24

Slide 24 text

OPTIMIZING BLIBLI MASTER - SLAVE PROBLEM

Slide 25

Slide 25 text

OPTIMIZING BLIBLI SHARDING (ELASTICSEARCH OR SOLRCLOUD)

Slide 26

Slide 26 text

OPTIMIZING BLIBLI SHARDING PROBLEM (RELEVANCY) ▸ The trick of relevancy is that search engines (Solr or Elasticsearch), are simply sophisticated text matching systems. They can tell you when the search word matches a word in the document, but they aren’t nearly smart or adaptable as human sales associate. ▸ Outside of this core “engine”, a lot of search relevancy is about development required to text analysis, correctly boosting/weighting on the right factors, tags ontologies or natural language processing.

Slide 27

Slide 27 text

OPTIMIZING BLIBLI CORE ENGINE RELEVANCY PROBLEM

Slide 28

Slide 28 text

REAL TIME SEARCH OPTIMIZING BLIBLI SEARCH

Slide 29

Slide 29 text

OPTIMIZING BLIBLI CURRENT BLIBLI INDEX ANALYZER ▸ Currently we are using stop word to analyze the text. ▸ Customer can only search word by word. ▸ We need to used N-Gram index analyzer if we want to implement Real Time Search.

Slide 30

Slide 30 text

OPTIMIZING BLIBLI STOP WORD ANALYZER PROBLEM

Slide 31

Slide 31 text

OPTIMIZING BLIBLI DEKORUMA REAL TIME SEARCH (USING ALGOLIA)

Slide 32

Slide 32 text

OPTIMIZING BLIBLI IMPLEMENTING REAL TIME SEARCH ▸ Implementing Real Time Search is challenging, especially in facet/aggregation. ▸ We can use google search technic. ▸ When user typing, we can show real time search result. ▸ When user stop typing or hit enter, we show the facet/aggregation.

Slide 33

Slide 33 text

THANKS