Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time...

182
Scaling Saved Searches Serving real time push-notifications for millions saved searches 466382733

Transcript of Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time...

Page 1: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Scaling Saved Searches Serving real time push-notifications for millions

saved searches

466382733

Page 2: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 3: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 4: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Who are we?

Page 5: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

ebaykleinanzeigen≠ebay

Page 6: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 7: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

What are we?

Page 8: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

ads= classified ads

Page 9: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 10: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 11: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 12: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 13: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 14: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 15: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

some numbers

Page 16: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

22M ads live!

Page 17: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

18M searches/day

Page 18: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 19: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 20: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 21: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Saved Searches Serving real time push-notifications for

millions saved searches

466382733

Page 22: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

700k new ads/day8M saved searches

Page 23: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

48.000.000.000theoretical matchesa day!

Page 24: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

p r o c e s si t !

Page 25: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

What?

Page 26: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 27: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 28: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 29: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 30: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 31: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 32: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 33: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 34: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 35: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

How?

Page 36: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

* * 0/1 * * ?

Page 37: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

r e a l t i m e ?

Page 38: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

s c a l a b l e ?

Page 39: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

C a n w e d ob e t t e r ?

Page 40: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

2 0 1 5

Page 41: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

src=https://www.esciencecenter.nl/img/main/logo-elastic.png

Page 42: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Percolator

Traditionally you design documents based on your data, store them into an index, and then define queries via the search API in order to retrieve these documents. The percolator works in the opposite direction. First you store queries into an index and then, via the percolate API, you define documents in order to retrieve these queries.

src=https://www.elastic.co/guide/en/elasticsearch/reference/current/search-percolate.html

Page 43: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 44: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 45: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 46: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 47: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 48: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 49: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 50: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 51: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 52: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 53: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 54: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 55: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 56: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 57: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 58: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 59: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

H o wm a n yp u s h e sp e r d a y ?

Page 60: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 61: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

~3x

Page 62: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

How?

Page 63: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

700k new ads/day

Page 64: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

match all?

Page 65: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

a s k s e a r c h

Page 66: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

h o wm a n yr e s u l t s ?

Page 67: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

c r e a t eb u c k e t s

Page 68: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

0 - 100: RT101 - 1000: 1h1001 - 10000: 2h> 10000: 6h

Page 69: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

...

Page 70: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

l i f e t i m eo f a s e a r c h

Page 71: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 72: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 73: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

s l e e p ...Z Z Z Z Z Z

Page 74: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Z Z Z Z Z Z

Page 75: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 76: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 77: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 78: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

S e t u p

Page 79: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

S e t u p

Page 80: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 81: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

cloud

Page 82: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

2 data centers

Page 83: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

2 data centers 10 data + 3 master

Page 84: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

2 data centers 10 data + 3 master

Page 85: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

replication x1shards x80

Page 86: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 87: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 88: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 89: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

SOLVED ES5

Page 90: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

s k i po n o v e r l o a d

Page 91: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 92: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

e l a s t i c f a s to n i n d e x i n g

Page 93: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

f i l t e rs l e e p i n gs e a r c h e s

Page 94: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 95: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

m e t a d a t a

Page 96: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

filter:{“next_pushdate”:[* TO NOW]}

Page 97: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

o n l y 3 0 % s e a r c h e sa r eo n l i n e

Page 98: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

d e s k t o p

Page 99: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

a v o i dd b - r e a d p e rs e a r c h

Page 100: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

h a s h p e rs e a r c h

Page 101: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

b l o o m f i l t e ri n c o o k i e

Page 102: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

src=https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Bloom_filter.svg/2000px-Bloom_filter.svg.png

Page 103: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

a p p s

Page 104: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

d e e p l i n ko n r e s u l t s i z e

Page 105: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 106: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

5

Page 107: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

5

1

Page 108: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

s t o r es e a r c h e sl o c a l

Page 109: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

b a c k e n ds y n co n a c t i o n s

Page 110: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

S a v e dS e a r c h

Page 111: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

S t a b l e ?

Page 112: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

S t a b i l i z ee l a s t i c

Page 113: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Boost your percolator!

Tips & Tricks

Page 114: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

“This indeed seems like a large application of

percolate.”Elastic support, June 2015

Page 115: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Performance linear with number of queries

Page 116: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

1. Consider using other systems.

Page 117: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

1. Consider using other systems.

“It is worth noting that simple exist matches on a field are probably not a great application for percolator. This doesn’t

utilize any text matching capability or complex boolean.”

Anything,anywhere!

Every ad offering something for free!

Page 118: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

1. Consider using other systems.

Page 119: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

2. Optimise your data structure.

Page 120: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

2. Optimise your data structure.

Page 121: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

2. Optimise your data structure.

Page 122: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

3. Filter, filter, filter!

Page 123: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

3. Filter, filter, filter!

“The filter only works on the metadata fields. The query field isn’t indexed by default.”

Page 124: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

3. Filter, filter, filter!

CATEGORY: cars

CATEGORY:all

CATEGORY:cars OR all

Page 125: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

… what else can we filter?

3. Filter, filter, filter!

Page 126: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

3. Filter, filter, filter!

Page 127: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

4. Use bulk requests.

Page 128: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

5. Use parallel bulk requests.

Page 129: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

5. Use parallel bulk requests.

index

node1 A1

node2 A2

Page 130: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

5. Use parallel bulk requests.

“Currently, to utilise all of your shards, you would need to consider sending multipercolate requests in parallel.”

index

node1 A1

node2 A2

https://github.com/elastic/elasticsearch/issues/13177

Page 131: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

5. Use parallel bulk requests.

Page 132: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

6. Degrade gracefully

Page 133: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Matthias:Antique copper lamps in Pankow

André:Cars in Berlin

6. Degrade gracefully

Page 134: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

6. Degrade gracefully

André:Cars in Berlin

Matthias:Antique copper lamps in Pankow

Page 135: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

6. Degrade gracefully

HIGH PRIORITYLOW PRIORITY

André:Cars in Berlin

Matthias:Antique copper lamps in Pankow

Page 136: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

6. Degrade gracefully

Page 137: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Outcome

Reduced percolation time:

Page 138: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Outcome

Doubled the number of push notifications:

Page 139: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

S t a b i l i z ee l a s t i c

Page 140: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

S t a b l e ?

Page 141: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

8 0 0 0 0 0 0 s e a r c h e s7 0 0 0 0 0a d s / d a y

Page 142: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

S t a b i l i z ep l a t f o r m

Page 143: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

eBayK saved searches goes 2016

architecture

Page 144: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Before: one DB rules it all

MySQL

Page 145: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Before: one DB rules it all

create saved search

MySQL

Page 146: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Before: one DB rules it all

create saved search

change saved search

MySQL

Page 147: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Before: one DB rules it all

create ad

create saved search

change saved search

MySQL

Page 148: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Before: one DB rules it all

create ad

create saved search

change saved search

MySQL

found match

Page 149: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Before: one DB rules it all

create ad

create saved search

change saved search

MySQLgot push

found match

Page 150: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

MySQL

Before...

Page 151: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

MySQL

AwakeJob

Before...

Page 152: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

MySQL

AwakeJob

SendJob

CreateJob

Before...

Page 153: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

MySQL

CleanupJob

AwakeJob

SendJob

IndexerJobCreateJob

ExpireJob

Before...

Page 154: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Before: bottleneck communication via DB

super high performance

resiliency

scalability..?

Page 155: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Goal: event-driven data pipeline

Page 156: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 157: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

What is Apache Kafka?distributed messaging system - persistent - high throughput

Topic 1

Topic 2

Producer

Producer

Consumer

Consumer

Consumer

Page 158: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

But what’s new?

Page 159: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

But what’s new?

12 3

Page 160: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Now: streams and data flows

percolate

create ad

Page 161: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Now: streams and data flows

percolate

create ad

found match

Page 162: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Now: streams and data flows

percolate

process match

create ad

found match

Page 163: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Now: streams and data flows

percolate

process push

create ad

found match

Page 164: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Now: streams and data flows

percolate

process push

create ad

found match

MySQL

Page 165: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Now: streams and data flows

percolate

process push

create ad

found match

MySQL

Page 166: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Compaction

Page 167: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Compaction: Kafka == source of truth?

Page 168: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Compaction: Kafka == source of truth?

A:23

B:12

B:null

C:0

A:24

time

Page 169: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Compaction: Kafka == source of truth?

A:23

B:12

B:null

C:0

A:24

A:24

C:0

time

Page 170: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Compaction: Kafka == source of truth?

A:24

C:0

time

Page 171: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Compaction: Kafka == source of truth?

Consumer

A:24

C:0

Page 172: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Compaction: Kafka == source of truth?

Consumer

A:24

C:0

Page 173: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Compaction: Kafka == source of truth?

Consumer

A:24

C:0

Page 174: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Issues encountered

Page 175: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Issues encountered

latency - used local cache

Page 176: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Issues encountered

some components couldn’t keep up - spot-on optimisation

latency - used local cache

Page 177: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

Issues encountered

some components couldn’t keep up - spot-on optimisation

out of order writes - ?

latency - used local cache

Page 178: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

w r a p u p

Page 179: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

simplicityfine tune elasticuse streaming

Page 180: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

T h a n ky o u

Page 181: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on
Page 182: Scaling Saved Searches - GOTO Conference · Scaling Saved Searches Serving real time push-notifications for millions saved searches ... Traditionally you design documents based on

References

”Building LinkedIn’s Real-time Activity Data Pipeline”, Ken Goodhope, Joel Koshy, Jay Kreps, Neha Narkhede, Richard Park, Jun Rao, Victor Yang Ye