Skip to content

Commit

Permalink
Update metadata experiment with seed
Browse files Browse the repository at this point in the history
  • Loading branch information
sacheendra committed Jan 31, 2024
1 parent e2f1ecc commit 9ca5d70
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import org.opendc.simulator.core.SimulationCoroutineScope
import org.opendc.telemetry.compute.table.StorageInfo
import org.opendc.telemetry.sdk.metrics.export.CoroutineMetricReader
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.random.asKotlinRandom

class MetadataExperiment : Experiment(name = "metadata") {
private val logger = KotlinLogging.logger {}
Expand All @@ -46,7 +47,7 @@ class MetadataExperiment : Experiment(name = "metadata") {
override fun doRun(repeat: Int) : Unit = runBlockingSimulation(stop, EmptyCoroutineContext, ::experiment)

suspend fun experiment(scope : SimulationCoroutineScope){
val seeder = Random(0)
val seeder = Random(36542)
val workload = workloadTrace.resolve(workloadLoader, seeder)

val telemetry = SdkTelemetryManager(scope.clock)
Expand All @@ -68,6 +69,7 @@ class MetadataExperiment : Experiment(name = "metadata") {
numCores = storageServerCores,
speed = storageServerCoreSpeed,
meterProvider = meterProvider,
randomSource = seeder.asKotlinRandom()
)
val runner = ComputeServiceHelper(
scope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import kotlinx.coroutines.channels.Channel
import org.opendc.simulator.core.SimulationCoroutineScope
import java.util.Collections.max
import kotlin.math.max
import kotlin.random.Random
import kotlin.random.asKotlinRandom
import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.DurationUnit


public class StorageService(private val scope :SimulationCoroutineScope, private val numServers : Long, private val numCores : Long, private val speed : Double, meterProvider: MeterProvider){
public class StorageService(private val scope :SimulationCoroutineScope, private val numServers : Long, private val numCores : Long, private val speed : Double, meterProvider: MeterProvider,
private val randomSource: Random){
private val servers = mutableListOf<Server>()

val meter = meterProvider.get("org.opendc.experiments.metadata")
Expand All @@ -41,7 +44,7 @@ public class StorageService(private val scope :SimulationCoroutineScope, private
return
}

val randServer = servers.random()
val randServer = servers.random(randomSource)

randServer.Set(objectId, size)
objectToServer[objectId] = randServer
Expand Down
16 changes: 8 additions & 8 deletions plot/script/metadata_plot_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def plot_results(
{
"legend.title_fontsize": TEXT_FONTSIZE,
"font.size": TEXT_FONTSIZE,
"figure.figsize": (15 * cm, 7.2 * cm),
"figure.figsize": (14 * cm, 7.2 * cm),
"text.usetex": True,
"font.family": "libertine",
}
Expand Down Expand Up @@ -162,13 +162,13 @@ def plot_results(
title_fontsize=TEXT_FONTSIZE,
)

ax.set_xlabel(f"Total time [{TIME_UNIT_ACRONYM[TIME_UNIT]}]")
ax.set_xlabel(f"Total time [m]")

left, right = axes
left.annotate(
"",
xy=(2.2e14 / 3.6e12, 1.5e11),
xytext=(2.2e14 / 3.6e12, 2.35e11),
xy=(2.2e14 / 3.6e12, 1.9e11),
xytext=(2.2e14 / 3.6e12, 2.6e11),
arrowprops=dict(
facecolor="#CDEB8B",
shrink=0.05,
Expand All @@ -180,14 +180,14 @@ def plot_results(
left.text(
2.25e14 / 3.6e12,
1.7e11,
r"\textbf{85GB\\buffer size\\(36\%)}",
r"\textbf{70GB\\buffer size\\(27\%)}",
fontdict={"size": ARROW_FONTSIZE},
)

right.annotate(
"",
xy=(7.8e1, 0.85),
xytext=(1.3e2, 0.85),
xy=(0.7e2, 0.5),
xytext=(1e2, 0.5),
arrowprops=dict(
facecolor="#CDEB8B",
shrink=0.05,
Expand All @@ -196,7 +196,7 @@ def plot_results(
headlength=LINEWIDTH * 4 * 1.5,
),
)
right.text(1.45e2, 0.8, r"\textbf{52h\\(40\%)}", fontdict={"size": ARROW_FONTSIZE})
right.text(1.45e2, 0.5, r"\textbf{25m\\(25\%)}", fontdict={"size": ARROW_FONTSIZE})

left.annotate(" ", xy=(-5, 1.5e11), annotation_clip=False)
plt.subplots_adjust(wspace=0.4)
Expand Down

0 comments on commit 9ca5d70

Please sign in to comment.