pravega / pravega-benchmark

Performance benchmark tool for Pravega
Apache License 2.0
8 stars 22 forks source link

Issue 85: Add Stream auto-scaling option in Pravega Benchmark #86

Closed RaulGracia closed 4 years ago

RaulGracia commented 4 years ago

Change log description Adds the ability to create Stream with auto-scaling policies in Pravega Benchmark.

Purpose of the change Fixes #85.

What the code does This PR adds 3 new options for the parameterization of the tool (segmentScaleKBps, segmentScaleEventsPerSecond, scaleFactor ):

 -scaleFactor <arg>                   If the scale policy is configured,
                                      this parameter defines the number of
                                      new segmentsto be created once
                                      Pravega determines to split a
                                      segment.
 -segmentScaleEventsPerSecond <arg>   Setting this option enables Stream
                                      auto-scaling.This option tells the
                                      throughput in events/second that a
                                      Stream segment should receive to be
                                      candidate for split (scaleFactor new
                                      segments will be created).
 -segmentScaleKBps <arg>              Setting this option enables Stream
                                      auto-scaling.This option tells the
                                      throughput in KBps that a Stream
                                      segment should receive to be
                                      candidate for split (scaleFactor new
                                      segments will be created).

While the default behavior remains the same (Streams have fixed scaling policies), these options now allow us to exercise autoscaling with Pravega benchmark.

How to verify it Executed several benchmarks with scaling policies enabled, and confirmed that autoscaling is triggered on the Streams:

./bin/pravega-benchmark -controller tcp://xxx:9090 -producers 1 -size 1000 -segments 1 -segmentScaleEventsPerSecond 100 -events 1000 -time 10000 -stream newStreamScaleEps -scaleFactor 4

Note that the policy is correctly submitted in the create stream requests:

2020-01-03 15:21:34:815 +0000 [main] INFO io.pravega.client.admin.impl.StreamManagerImpl - Creating scope/stream: Scope/newStreamScaleEps with configuration: StreamConfiguration(scalingPolicy=ScalingPolicy(scaleType=BY_RATE_IN_EVENTS_PER_SEC, targetRate=100, scaleFactor=4, minNumSegments=1), retentionPolicy=null, timestampAggregationTimeout=0)

Looking at the AutoScaleProcessor logs, we can observe that scale up takes place:

2020-01-03 15:20:14,611 11923 [auto-scaler-2] INFO  i.p.s.s.h.stat.AutoScaleProcessor - AutoScale Processor Initialized. RequestStream=_requeststream
2020-01-03 15:23:35,244 212556 [auto-scaler-1] INFO  i.p.s.s.h.stat.AutoScaleProcessor - received traffic for Scope/newStreamScaleEps/0.#epoch.0 with twoMinute rate = 971.7989782980599 and targetRate = 100
2020-01-03 15:25:35,254 332566 [auto-scaler-6] INFO  i.p.s.s.h.stat.AutoScaleProcessor - received traffic for Scope/newStreamScaleEps/0.#epoch.0 with twoMinute rate = 989.5801564349287 and targetRate = 100
2020-01-03 15:27:35,261 452573 [auto-scaler-9] INFO  i.p.s.s.h.stat.AutoScaleProcessor - received traffic for Scope/newStreamScaleEps/0.#epoch.0 with twoMinute rate = 996.1767984195764 and targetRate = 100
2020-01-03 15:29:35,265 572577 [auto-scaler-1] INFO  i.p.s.s.h.stat.AutoScaleProcessor - received traffic for Scope/newStreamScaleEps/0.#epoch.0 with twoMinute rate = 998.5686043110853 and targetRate = 100
2020-01-03 15:31:35,272 692584 [auto-scaler-5] INFO  i.p.s.s.h.stat.AutoScaleProcessor - received traffic for Scope/newStreamScaleEps/0.#epoch.0 with twoMinute rate = 999.4689404006488 and targetRate = 100
2020-01-03 15:31:35,273 692585 [auto-scaler-5] INFO  i.p.s.s.h.stat.AutoScaleProcessor - [requestId=-5476528379974446203] sending request for scale up for Scope/newStreamScaleEps/0.#epoch.0

And the metrics confirm that the number of segments has increased by scaleFactor:

autoscaling