18
Autoscaling for fun and profit Alexander Demidko, Software Engineer @ Metamarkets

Autoscaling for fun and profit

Embed Size (px)

Citation preview

Page 1: Autoscaling for fun and profit

Autoscaling for fun and profitAlexander Demidko,

Software Engineer @ Metamarkets

Page 2: Autoscaling for fun and profit

API

Kafka Druid

Page 3: Autoscaling for fun and profit

0.5PB сырых входящих/день => $$$$

Page 4: Autoscaling for fun and profit

API

Kafka Druid

Batch – EC2 Spot :)

Real-time – EC2 On-Demand $-(

Page 5: Autoscaling for fun and profit
Page 6: Autoscaling for fun and profit
Page 7: Autoscaling for fun and profit
Page 8: Autoscaling for fun and profit

• Быстро реагировать

• Выбирать стратегию: A) +10 контейнеров (30 мин)=> –10 контейнеров B) +40 контейнеров (20 мин)=> –40 контейнеров

• Учитывать прогнозы: объем входящих данных = f(время)пропускная способность = g(контейнеров)

Page 9: Autoscaling for fun and profit

Monte Carlo Tree Search

стоимость = железо + пенальти за задержку

число контейнеров

Page 10: Autoscaling for fun and profit

penalty(s, l)(x) = (atan(x*s – l*s) + atan(l*s)) / (0.5*π + atan(l*s))

Page 11: Autoscaling for fun and profit

• Selection - выбираем, где строить новый узел (exploration VS exploitation tradeoff) • Expansion - строим его :) • Simulation - эвристически оцениваем, во сколько он обойдется • Backpropagation - обновляем стоимости решений в дереве

Page 12: Autoscaling for fun and profit

Simulation

Page 13: Autoscaling for fun and profit

Уменьшение размерности дерева

• Дискретизация числа контейнеров • Дискретизация времени

Page 14: Autoscaling for fun and profit

Guardian

job_A - 5 => 10 контейнеровjob_B - 8 => 6 контейнеров

job_C - 15 => 20 контейнеров

job_A - 5 => 15 контейнеров

job_D - 2 => 4 контейнеров

Page 15: Autoscaling for fun and profit

Health monitoring

t_curr t_last

Kafka

Page 16: Autoscaling for fun and profit

Колебания: не можем точно выставить идеальное число контейнеров Число Kafka партиций % Число контейнеров must be(0)

avg = 35100 / (24*60) ~ 24

Page 17: Autoscaling for fun and profit

Уменьшили объем железа почти в 2 раза

Математика/реализация: 20/80

Page 18: Autoscaling for fun and profit

Спасибо!