Skip to content

Instantly share code, notes, and snippets.

@kulikov
Created October 24, 2013 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kulikov/7137736 to your computer and use it in GitHub Desktop.
Save kulikov/7137736 to your computer and use it in GitHub Desktop.
object ScaleFactor {
val T1MicroSpeed = 10.0
def calcNeedInstances(avgSpeed: Int, queueSize: Int): Int = {
val taskPerHour = avgSpeed * 3600
val maxInstances = math.ceil(avgSpeed / T1MicroSpeed)
queueSize / taskPerHour.toDouble match {
case h if h < 1 ⇒ math.ceil(maxInstances * h).toInt
case _ ⇒ maxInstances.toInt
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment