[lxc-devel] [lxd/master] benchmark: Allow instantly freezing containers
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Apr 5 05:16:56 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 443 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160405/70f1c8c3/attachment.bin>
-------------- next part --------------
From cf915fed00510ed36ea46b8373177409c81fd799 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 5 Apr 2016 01:16:02 -0400
Subject: [PATCH] benchmark: Allow instantly freezing containers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This makes it possible to measure scalability with limited
container-generated load.
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
test/lxd-benchmark/main.go | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/test/lxd-benchmark/main.go b/test/lxd-benchmark/main.go
index 2f69dcd..b35ded5 100644
--- a/test/lxd-benchmark/main.go
+++ b/test/lxd-benchmark/main.go
@@ -17,6 +17,7 @@ var argCount = gnuflag.Int("count", 100, "Number of containers to create")
var argParallel = gnuflag.Int("parallel", -1, "Number of threads to use")
var argImage = gnuflag.String("image", "ubuntu:", "Image to use for the test")
var argPrivileged = gnuflag.Bool("privileged", false, "Use privileged containers")
+var argFreeze = gnuflag.Bool("freeze", false, "Freeze the container right after start")
func main() {
err := run(os.Args)
@@ -86,6 +87,11 @@ func spawnContainers(c *lxd.Client, count int, image string, privileged bool) er
privilegedStr = "privileged"
}
+ mode := "normal startup"
+ if *argFreeze {
+ mode = "start and freeze"
+ }
+
fmt.Printf("Test environment:\n")
fmt.Printf(" Server backend: %s\n", st.Environment.Server)
fmt.Printf(" Server version: %s\n", st.Environment.ServerVersion)
@@ -100,6 +106,7 @@ func spawnContainers(c *lxd.Client, count int, image string, privileged bool) er
fmt.Printf("Test variables:\n")
fmt.Printf(" Container count: %d\n", count)
fmt.Printf(" Container mode: %s\n", privilegedStr)
+ fmt.Printf(" Startup mode: %s\n", mode)
fmt.Printf(" Image: %s\n", image)
fmt.Printf(" Batches: %d\n", batches)
fmt.Printf(" Batch size: %d\n", batch)
@@ -182,6 +189,21 @@ func spawnContainers(c *lxd.Client, count int, image string, privileged bool) er
logf(fmt.Sprintf("Failed to spawn container '%s': %s", name, err))
return
}
+
+ // Freeze
+ if *argFreeze {
+ resp, err = c.Action(name, "freeze", -1, false, false)
+ if err != nil {
+ logf(fmt.Sprintf("Failed to spawn container '%s': %s", name, err))
+ return
+ }
+
+ err = c.WaitForSuccess(resp.Operation)
+ if err != nil {
+ logf(fmt.Sprintf("Failed to spawn container '%s': %s", name, err))
+ return
+ }
+ }
}
logf("Starting the test")
More information about the lxc-devel
mailing list