Make MetricsBasedResizerSpec a bit slower but less GC sensitive #24397 (#24449)

This commit is contained in:
Johan Andrén 2018-02-12 13:26:14 +01:00 committed by GitHub
parent caabfdecfc
commit 5e6662c97c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View file

@ -241,7 +241,7 @@ class MetricsBasedResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultT
msgs1.foreach(_.second.open()) //process two messages
// make sure some time passes inbetween
Thread.sleep(100)
Thread.sleep(300)
// wait for routees to update their mail boxes
msgs2.foreach(l Await.ready(l.first, timeout.duration))
@ -273,7 +273,7 @@ class MetricsBasedResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultT
msgs1.foreach(_.second.open()) //process two messages
// make sure some time passes inbetween
Thread.sleep(100)
Thread.sleep(300)
// wait for routees to update their mail boxes
msgs2.foreach(l Await.ready(l.first, timeout.duration))

View file

@ -7,14 +7,13 @@ import java.time.LocalDateTime
import scala.collection.immutable
import java.util.concurrent.ThreadLocalRandom
import scala.concurrent.duration._
import com.typesafe.config.Config
import akka.actor._
import akka.util.JavaDurationConverters._
import OptimalSizeExploringResizer._
import akka.annotation.InternalApi
trait OptimalSizeExploringResizer extends Resizer {
/**
@ -126,17 +125,26 @@ case class DefaultOptimalSizeExploringResizer(
explorationProbability: Double = 0.4,
weightOfLatestMetric: Double = 0.5) extends OptimalSizeExploringResizer {
/**
* INTERNAL API
*
* Leave package accessible for testing purpose
*/
@InternalApi
private[routing] var performanceLog: PerformanceLog = Map.empty
/**
* INTERNAL API
*
* Leave package accessible for testing purpose
*/
@InternalApi
private[routing] var record: ResizeRecord = ResizeRecord()
/**
* INTERNAL API
*
* Leave package accessible for testing purpose
*/
@InternalApi
private[routing] var stopExploring = false
private def random = ThreadLocalRandom.current()