This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial stab at making deployment plans cheaper.
Summary: - Should make deployment plans cheaper to create by making dependencyOrderedSteps only consider apps that actually changed. - Running into issues with getting JMH to not throw Incompatible Class Change issues. Test Plan: ``` for i in `seq 1 5000`; do http :8080/v2/apps <<EOF { "id": "/$i", "cmd": "cat", "dependencies": ["/$((i - 1))"] } EOF done ``` Profiled that. shared in #marathon-dev. Reviewers: unterstein, zen-dog, aquamatthias, jasongilanfarr, jenkins Reviewed By: unterstein, jasongilanfarr, jenkins Subscribers: jeschkies, marathon-team Differential Revision: https://phabricator.mesosphere.com/D476
- Loading branch information
1 parent
fdecd32
commit 94efcee
Showing
6 changed files
with
147 additions
and
21 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
benchmark/src/main/scala/mesosphere/marathon/stream/ScalaConversionsState.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package mesosphere.marathon.stream | ||
|
||
import org.openjdk.jmh.annotations.{ Scope, State } | ||
|
||
import scala.collection.immutable.Seq | ||
|
||
@State(Scope.Benchmark) | ||
object ScalaConversionsState { | ||
val small: Seq[Int] = 0.to(100) | ||
val medium: Seq[Int] = 0.to(1000) | ||
val large: Seq[Int] = 0.to(10000) | ||
val veryLarge: Seq[Int] = 0.to(1000 * 1000) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
benchmark/src/main/scala/mesosphere/marathon/upgrade/DependencyGraphBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package mesosphere.marathon | ||
package upgrade | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
import mesosphere.marathon.state.AppDefinition.AppKey | ||
import mesosphere.marathon.state.Group.GroupKey | ||
import mesosphere.marathon.state.PathId._ | ||
import mesosphere.marathon.state._ | ||
import org.openjdk.jmh.annotations.{ Group => _, _ } | ||
import org.openjdk.jmh.infra.Blackhole | ||
|
||
import scala.collection.breakOut | ||
import scala.util.Random | ||
|
||
@State(Scope.Benchmark) | ||
object DependencyGraphBenchmark { | ||
val r = new Random(1000) | ||
|
||
val superGroupIds = 0 to 4 // no interdependencies here | ||
val groupIds = 0 to 5 | ||
val appIds = 0 to 10 | ||
val version1 = VersionInfo.forNewConfig(Timestamp(1)) | ||
val version2 = VersionInfo.forNewConfig(Timestamp(2)) | ||
|
||
val superGroups: Map[GroupKey, Group] = superGroupIds.map { superGroupId => | ||
|
||
val paths: Vector[Vector[PathId]] = | ||
groupIds.map { groupId => | ||
appIds.map { appId => | ||
s"/supergroup-${superGroupId}/group-${groupId}/app-${appId}".toPath | ||
}.toVector | ||
}(breakOut) | ||
|
||
val appDefs: Map[AppKey, AppDefinition] = | ||
groupIds.flatMap { groupId => | ||
appIds.map { appId => | ||
val dependencies = for { | ||
depGroupId <- groupIds if depGroupId < groupId | ||
depAppId <- appIds | ||
if r.nextBoolean | ||
} yield paths(depGroupId)(depAppId) | ||
|
||
val path = paths(groupId)(appId) | ||
path -> AppDefinition( | ||
id = path, | ||
dependencies = dependencies.toSet, | ||
labels = Map("ID" -> appId.toString), | ||
versionInfo = version1 | ||
) | ||
}(breakOut) | ||
}(breakOut) | ||
|
||
val subGroups: Map[GroupKey, Group] = groupIds.map { groupId => | ||
val id = s"supergroup-${superGroupId}/group-${groupId}".toPath | ||
id -> Group( | ||
id = id, | ||
transitiveAppsById = appDefs, | ||
transitivePodsById = Map.empty) | ||
}(breakOut) | ||
|
||
val id = s"/supergroup-${superGroupId}".toPath | ||
id -> Group( | ||
id = id, | ||
groupsById = subGroups, | ||
transitiveAppsById = subGroups.flatMap(_._2.transitiveAppsById)(breakOut), | ||
transitivePodsById = Map.empty) | ||
}(breakOut) | ||
|
||
val rootGroup = RootGroup( | ||
groupsById = superGroups) | ||
|
||
val upgraded = RootGroup( | ||
groupsById = superGroups.map { | ||
case (superGroupId, superGroup) => | ||
if (superGroupId == "/supergroup-0".toPath) { | ||
superGroupId -> Group( | ||
id = superGroupId, | ||
groupsById = superGroup.groupsById.map { | ||
case (id, subGroup) => | ||
id -> Group( | ||
id = id, | ||
transitiveAppsById = subGroup.transitiveAppsById.mapValues(_.copy(versionInfo = version2)), | ||
transitivePodsById = Map.empty) | ||
}, | ||
transitiveAppsById = superGroup.groupsById.flatMap { case (_, group) => group.transitiveAppsById.mapValues(_.copy(versionInfo = version2)) }, | ||
transitivePodsById = Map.empty | ||
) | ||
} else { | ||
superGroupId -> superGroup | ||
} | ||
}(breakOut) | ||
) | ||
} | ||
|
||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
@BenchmarkMode(Array(Mode.Throughput, Mode.AverageTime)) | ||
@Fork(1) | ||
class DependencyGraphBenchmark { | ||
import DependencyGraphBenchmark._ | ||
|
||
@Benchmark | ||
def deploymentPlanDependencySpeed(hole: Blackhole): Unit = { | ||
val deployment = DeploymentPlan(rootGroup, upgraded) | ||
hole.consume(deployment) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters