"building high performance search feature" by setyo legowo (urbanindo)

20
Building High Performance Search Feature MobileDevelopmentStage Tech in Asia Product Development Conference 2017 August 10 th , 2017

Upload: tech-in-asia-id

Post on 22-Jan-2018

219 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

BuildingHighPerformanceSearchFeatureMobileDevelopmentStageTechinAsiaProductDevelopmentConference2017

August10th,2017

Page 2: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

WhoamI?

• SetyoLegowo (@setyolegowo)

• CurrentlyworkasSoftwareEngineerinUrbanindo

• InformaticsgraduatefromInstitut Teknologi Bandung(ITB)

TechinAsia- PDC17,MobileDevStage

Page 3: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

Outline

• Whysearchfeaturematter

• Allaboutapplicationperformance

• Performancetesting

• Tipsforoptimizations

TechinAsia- PDC17,MobileDevStage

Page 4: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

TechinAsia- PDC17,MobileDevStage

Product NameKey / Terms Driver

List of ProductRelevance sites Closest driver

Page 5: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

TechinAsia- PDC17,MobileDevStage

Input

Search result

Page 6: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

Challenges

• Use-casesvariation

• Bugs

• Missioncriticalfeature

TechinAsia- PDC17,MobileDevStage

Page 7: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

“3”PerformanceIndicators

Memory

TechinAsia- PDC17,MobileDevStage

Processor

I/Oo Loadsearchresultand

assetstomemoryo Cachingo Compression

o Queryo Context

o Renderassetso CPUutilizationo Concurrency

Relevance

o Serverresponsetimeo Datausageo Offline

Page 8: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

LazyLoad

• Loadorrenderwhatneededtobeappearedonthescreen

• Mostlydelayloadingonassetsimage;pagingsearchresult(occasionally)

TechinAsia- PDC17,MobileDevStage

Page 9: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

Cache(Client)

• Saveassetsintoapplocalstorage,butdonotsaveallofit

• Veryusefulwhenoffline

• “Garbagecollection”strategy• Reusehighfrequencyloadedassets

• Specificcachestrategywhichparallelwithbusiness

TechinAsia- PDC17,MobileDevStage

Page 10: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

Cache(Server)

• UseContentDeliveryNetwork(CDN)• Lowbandwidthand/orCPUusagetoserver

• Cachehighfrequencyqueryanditsresultset• Cachemustbefasterthandatabase

• Easytomaintainifthecachedatabasecomplementwithusecase

TechinAsia- PDC17,MobileDevStage

Page 11: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

Concurrency

• Process/renderin“parallel”

• Pooltheprocessorthethreads• Betterifusethrottlingorqueuemechanism

• ThinktheprocessinDirectedAcyclicGraph

TechinAsia- PDC17,MobileDevStage

Page 12: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

TechinAsia- PDC17,MobileDevStage

Source:https://upload.wikimedia.org/wikipedia/commons/thumb/4/4b/Directed_acyclic_graph.svg/800px-Directed_acyclic_graph.svg.png

Page 13: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

Compression

• Compressassetsasmuchasyoucan

• Minimizestoragespaceusage

• Reducedatatransfercost

• Usebinarydatatransfer insteadofalphabetbase

• Disadvantages:usemoreCPU

TechinAsia- PDC17,MobileDevStage

Page 14: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

SearchResultRelevance

• Usequerylanguage

• Pronetoambiguous

• Advance:Usetextsimilarityalgorithm

TechinAsia- PDC17,MobileDevStage

Page 15: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

Thereareanydrawbacks?

• Architecturetendtobemorecomplex

• Optimizationtendstomakecodehardertounderstandand

maintain

• Overfocusoninsignificantperformanceimprovement

TechinAsia- PDC17,MobileDevStage

Page 16: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

PerformanceTesting

• Definethemetrics(e.g.SLA)andobeytoit

• Applicationprofiling

• Findbottleneckorhotspot

TechinAsia- PDC17,MobileDevStage

Page 17: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

TipsforOptimization(ingeneral)

• Findthebottleneck/hotspotasearlyaspossible

• Follow80/20rules

• Definemetrics• Numberof search,uniquesearch,result,…

• Measuretherightloadbetweenmemory,CPU,andI/O

• Cleancode

TechinAsia- PDC17,MobileDevStage

Page 18: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

TipsforOptimization(searchfeature)

• Progressiveupdate• Rendersearchresulteagerly“only”theappearedcontentorpanel

• Cacheasmuchaspossible

• Abletoruninofflinemode

TechinAsia- PDC17,MobileDevStage

Page 19: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

Anyquestion?

TechinAsia- PDC17,MobileDevStage

Page 20: "Building High Performance Search Feature" by Setyo Legowo (UrbanIndo)

ThankYou

TechinAsia- PDC17,MobileDevStage