Slide 1

Slide 1 text

elasticsearch @ ferret go ES UG Berlin Meetup, 2012-11-27 Fabian Neumann (@hellp) Daniel Trümper (@truemped)

Slide 2

Slide 2 text

"ferret go" -- THE PROJECT * media analysis * online, print, social * -> rss/atom -> storm -> ES -> web app * linguistics (sentiment, entity recognition etc.) * Also:redis, Python, Pyramid, ...

Slide 3

Slide 3 text

"ferret go" -- THE LOCATION * Bernau b. Berlin, Brandenburg * Zickenschulze (German food) * No (good) Asian food * Rollator races * Like Kreuzberg without the fancy

Slide 4

Slide 4 text

"ferret go" -- THE PROJECT * shrt dmo

Slide 5

Slide 5 text

THE BLACK WEEK * WHY suddenly? * more data (1 October = 4 Julies) * moving indexes; (bulk) re-indexing * more users * long-term queries now more long-term * config-/brain-less ES setup (which is nice!) only worked for us so long

Slide 6

Slide 6 text

ES SETUP * 2 indices * 6 data nodes (i7, 8 cores, 32G mem, 16G for ES) * each index: 12 shards * 3 replicas = 72 shards per index (too much, we know ...)

Slide 7

Slide 7 text

SENSIBLE SHARD-BALANCING? INDX 1 INDX 2 NODE 1 ▒ ▒ ▒ ▒ ▒ ▓ NODE 2 ▒ ▒ ▓ ▓ ▓ ▓ NODE 3 ▒ ▓ ▓ ▓ ▓ ▓ NODE 4 ▒ ▒ ▒ ▒ ▒ ▓ ... shard sizes ^-- 12G 0.5G --^

Slide 8

Slide 8 text

SENSIBLE SHARD-BALANCING? INDX 1 INDX 2 NODE 1 ▒ ▒ ▒ ▒ ▒ ▓ NODE 2 ▒ ▒ ▓ ▓ ▓ ▓ NODE 3 ▒ ▓ ▓ ▓ ▓ ▓ NODE 4 ▒ ▒ ▒ ▒ ▒ ▓ ... ^-- also more complex queries shard sizes ^-- 12G 0.5G --^

Slide 9

Slide 9 text

SENSIBLE LOAD-BALANCING? NODE 1 ▒ ▒ ▒ ▒ ▒ <- NODE 2 ▒ ▒ <- NODE 3 ▒ <- NODE 4 ▒ ▒ ▒ ▒ ▒ <- > import pyes > # All nodes in a list, passed to urllib3 PoolManager, > # free load-balancing, yay! > conn = pyes.ES([node1, node2, node3, node4]) > res = conn.search(query_model.to_es_query()) > return res

Slide 10

Slide 10 text

SENSIBLE LOAD-BALANCING? NODE 1 ▒ ▒ ▒ ▒ ▒ <- <- <- <- <- <- NODE 2 ▒ ▒ <- NODE 3 ▒ NODE 4 ▒ ▒ ▒ ▒ ▒ > import pyes > # All nodes in a list, passed to urllib3 PoolManager, > # free load-balancing, yay! NOT! 3 are just fallback. Oops. > conn = pyes.ES([node1, node2, node3, node4]) “The PoolManager will take care of reusing connections for you whenever you request the same host.”

Slide 11

Slide 11 text

SENSIBLE NODE CONFIGURATION? NODE 1 ▒ ▒ ▒ ▒ ▒ /(x.x)\ <-- JVM NODE 2 ▒ ▒ NODE 3 ▒ NODE 4 ▒ ▒ ▒ ▒ ▒ /(x.x)\ $ grep cache /etc/elasticsearch/elasticsearch.yml $ (hey, that looked like /dev/null ...) $ grep OutOfMemoryErr /var/log/elasticsearch/heck.log | wc -l 1337 $ # ... or rather n00b

Slide 12

Slide 12 text

SENSIBLE NODE CONFIGURATION? NODE 1 ▒ ▒ ▒ ▒ ▒ \(^.^)/ <-- JVM NODE 2 ▒ ▒ NODE 3 ▒ NODE 4 ▒ ▒ ▒ ▒ ▒ \(^.^)/ $ grep cache /etc/elasticsearch/elasticsearch.yml index.cache.field.type: soft $ grep OutOfMemoryErr /var/log/elasticsearch/heck.log | wc -l 0 $ # much better

Slide 13

Slide 13 text

CURRENT (IMPROVED!) SITUATION

Slide 14

Slide 14 text

MANUAL BALANCED SHARDS INDX 1 INDX 2 NODE 1 ▒ ▒ ▓ ▓ ▓ NODE 2 ▒ ▒ ▓ ▓ ▓ NODE 3 ▒ ▒ ▓ ▓ ▓ NODE 4 ▒ ▒ ▓ ▓ ▓

Slide 15

Slide 15 text

NO-DATA NODES FOR LOAD-BALANCING INDX 1 INDX 2 NODE 1 ▒ ▒ ▓ ▓ ▓ <- <- NODE 2 ▒ ▒ ▓ ▓ ▓ <- <- NODE 3 ▒ ▒ ▓ ▓ ▓ <- <- NODE 4 ▒ ▒ ▓ ▓ ▓ <- <- NODE 5 <- <- <- <- <- <- <- <- <- NODE 6 <- <- <- <- <- <- <-

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

6 data nodes + some nodata nodes -> <- new docs/s

Slide 18

Slide 18 text

nodata node :) free LB; easy as HAProxy still too many shards :/ <- also queries/s :(

Slide 19

Slide 19 text

NEXT STEPS -- TECH LEVEL * time slicing (flexibility in shard/index layout) * request/shard routing (but no good routing criteria yet) * further config optimizations (flush/refresh intervals etc.) * smoother recovery phases

Slide 20

Slide 20 text

NEXT STEPS -- APP LEVEL * less query load (e.g. re-implement clustering process) * query optimizing (never cover the whole index, good, right?)

Slide 21

Slide 21 text

* thank you * dankeschön * дякую * merci beaucoup * obrigado :)

Slide 22

Slide 22 text

AFTERMATH -- USER GROUP INSIGHTS * some problems known to ES core devs * some will be fixed * ferret is a faceting-heavy app, which uses lots of memory. we need to be more careful about that. * JVM choice matters * avoid many growing pains, read this: http://asquera.de/opensource/2012/11/25/elasticsearch-pre-flight-checklist/