45
Varnishing Search Performance Changing the (search) engine of a racecar going 300 km/h Volkan Yazıcı http://vlkan.com/

Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Varnishing Search PerformanceChanging the (search) engine of a racecar going 300 km/h

Volkan Yazıcıhttp://vlkan.com/

Page 2: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Varnishing Search PerformanceChanging the (search) engine of a racecar going 300 km/h

Volkan Yazıcıhttp://vlkan.com/

SERIOUSLY!

Page 3: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Secret Agenda

I will try to convince you Elasticsearch performance

and caching are indeed difficult subjects. So that I can

justify our complex caching setup.

Page 4: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Who uses search anyway?

Page 5: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Who uses search anyway?

Page 6: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Who uses search anyway?

Metrics for 1 outof 10 nodes!

Page 7: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Who uses search anyway?

Metrics for 1 outof 10 nodes!

Consumed by 15 services!

Page 8: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

Page 9: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Page 10: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Add some boostand should spice.

Page 11: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Add some boostand should spice.

Needed a dozen more fields initially weren’t foreseen.

Page 12: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Add some boostand should spice.

Needed a dozen more fields initially weren’t foreseen.

Exploded the index size using a grenade of 30k synonyms!

Page 13: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Add some boostand should spice.

Needed a dozen more fields initially weren’t foreseen.

Needed to group hits by color, size, etc. Now you have a collapse.

Exploded the index size using a grenade of 30k synonyms!

Page 14: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Add some boostand should spice.

Needed a dozen more fields initially weren’t foreseen.

Needed to group hits by color, size, etc. Now you have a collapse.

Decided to add 20 aggregations.

Exploded the index size using a grenade of 30k synonyms!

Page 15: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Add some boostand should spice.

Needed a dozen more fields initially weren’t foreseen.

Needed to group hits by color, size, etc. Now you have a collapse.

Decided to add 20 aggregations.

Hey! There aren’t20 facets here!

Exploded the index size using a grenade of 30k synonyms!

Page 16: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Add some boostand should spice.

Needed a dozen more fields initially weren’t foreseen.

Needed to group hits by color, size, etc. Now you have a collapse.

Decided to add 20 aggregations.

Doubled the amount of aggregations.

Hey! There aren’t20 facets here!

Exploded the index size using a grenade of 30k synonyms!

Page 17: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofPerformance in Elasticsearch

FAST

SLOW

You have a couple of constant_scorefilters on analyzed fields.

Add some boostand should spice.

Needed a dozen more fields initially weren’t foreseen.

Needed to group hits by color, size, etc. Now you have a collapse.

Decided to add 20 aggregations.

Doubled the amount of aggregations.

Just realized you’re serving 5% of calls on production behind an A/B test.

Hey! There aren’t20 facets here!

Exploded the index size using a grenade of 30k synonyms!

Page 18: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice
Page 19: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

SLOW QUERY

CACHED

CACHED

Page 20: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

Page 21: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

Page 22: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

You decided to cache query responses.

Page 23: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

You decided to cache query responses.Reproducing production problemsbecomes more cumbersome.

Page 24: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

You decided to cache query responses.

Tune eviction this and there.Reproducing production problemsbecomes more cumbersome.

Page 25: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

You decided to cache query responses.

Tune eviction this and there.

You have to switch between multiple clusters.

Reproducing production problemsbecomes more cumbersome.

Page 26: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

You decided to cache query responses.

Tune eviction this and there.

You have to switch between multiple clusters.

Management interfaces:- which clusters are used for search- which clusters are getting indexed- in-progress index operations

Reproducing production problemsbecomes more cumbersome.

Page 27: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

You decided to cache query responses.

Tune eviction this and there.

You have to switch between multiple clusters.

Switching to a cold cluster hurts a lot!

Management interfaces:- which clusters are used for search- which clusters are getting indexed- in-progress index operations

Reproducing production problemsbecomes more cumbersome.

Page 28: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

You decided to cache query responses.

Tune eviction this and there.

You have to switch between multiple clusters.

Switching to a cold cluster hurts a lot!

Management interfaces:- which clusters are used for search- which clusters are getting indexed- in-progress index operations

How to warm-up?- replay traffic- gradually move traffic (session stickiness)

Reproducing production problemsbecomes more cumbersome.

Page 29: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

The Untold Story ofCaching with Elasticsearch

SIMPLE

COMPLEX

You decided to cache query responses.

Tune eviction this and there.

You have to switch between multiple clusters.

Switching to a cold cluster hurts a lot!

You need to migrate from a legacy system.

Management interfaces:- which clusters are used for search- which clusters are getting indexed- in-progress index operations

How to warm-up?- replay traffic- gradually move traffic (session stickiness)

Reproducing production problemsbecomes more cumbersome.

Page 30: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Hail the Legacy!Shop Find

Page 31: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Hail the Legacy!

Just before the season, the collapse becameobvious and team decided to add cachingwithout tempering much the rest of the system.

Shop Find

Page 32: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Hail the Legacy!

Just before the season, the collapse becameobvious and team decided to add cachingwithout tempering much the rest of the system.

A mudball of bash scripts mutatingLB routes, SSH’ing into machines,executing sudo commands via cron!

Shop Find

Page 33: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Long live the king!Shop Find

Shop Find Indexer

Page 34: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Long live the king!

Queries are routed to bothEND and ES via A/B tests.

Shop Find

Shop Find Indexer

Page 35: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Long live the king!

Queries are routed to bothEND and ES via A/B tests.

Retrieve the cluster states,i.e., active-vs-inactive.

Shop Find

Shop Find Indexer

Page 36: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Long live the king!

Queries are routed to bothEND and ES via A/B tests.

Retrieve the cluster states,i.e., active-vs-inactive.

Start-stop replayers.

Shop Find

Shop Find Indexer

Page 37: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Long live the king!

Queries are routed to bothEND and ES via A/B tests.

Retrieve the cluster states,i.e., active-vs-inactive.

Start-stop replayers.

Empty caches.

Shop Find

Shop Find Indexer

Page 38: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Long live the king!

Queries are routed to bothEND and ES via A/B tests.

Retrieve the cluster states,i.e., active-vs-inactive.

Start-stop replayers.

Empty caches.

Tune, index, and retune.

Shop Find

Shop Find Indexer

Page 39: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Long live the king!

Queries are routed to bothEND and ES via A/B tests.

Retrieve the cluster states,i.e., active-vs-inactive.

Start-stop replayers.

Empty caches.

Tune, index, and retune.

● All inter-service comm. via REST

Shop Find

Shop Find Indexer

Page 40: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Long live the king!

Queries are routed to bothEND and ES via A/B tests.

Retrieve the cluster states,i.e., active-vs-inactive.

Start-stop replayers.

Empty caches.

Tune, index, and retune.

● All inter-service comm. via REST● Actions are

● trackable● observable● manageable

Shop Find

Shop Find Indexer

Page 41: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Did it work? (1/2)(for generic queries)

Page 42: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Did it work? (1/2)(for generic queries)

Page 43: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Did it work? (2/2)(for single product queries)

Page 44: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Did it work? (2/2)(for single product queries)

Page 45: Varnishing Search Performance2018/02/17  · Performance in Elasticsearch FAST SLOW You have a couple of constant_score filters on analyzed fields. Add some boost and should spice

Questions?(Do you still want to have caching?)