6
6
import logging
7
7
import os
8
8
import platform
9
+ import pytest
10
+
9
11
from conftest import _test_images_s3_bucket
10
12
from framework .artifacts import ArtifactCollection , ArtifactSet
11
13
from framework .defs import DEFAULT_TEST_IMAGES_S3_BUCKET
28
30
SAMPLE_COUNT = 3
29
31
USEC_IN_MSEC = 1000
30
32
PLATFORM = platform .machine ()
33
+ ENGINES = ["Sync" ]
34
+
35
+ if is_io_uring_supported ():
36
+ ENGINES .append ("Async" )
31
37
32
38
# Latencies in milliseconds.
33
39
# The latency for snapshot creation has high variance due to scheduler noise.
60
66
# TODO: Update the table after fix. Target is < 5ms.
61
67
LOAD_LATENCY_BASELINES = {
62
68
"x86_64" : {
63
- "2vcpu_256mb.json" : {"target" : 9 },
64
- "2vcpu_512mb.json" : {"target" : 9 },
69
+ "4.14" : {
70
+ "sync" : {
71
+ "2vcpu_256mb.json" : {"target" : 9 },
72
+ "2vcpu_512mb.json" : {"target" : 9 },
73
+ }
74
+ },
75
+ "5.10" : {
76
+ "sync" : {
77
+ "2vcpu_256mb.json" : {"target" : 60 },
78
+ "2vcpu_512mb.json" : {"target" : 60 },
79
+ },
80
+ "async" : {
81
+ "2vcpu_256mb.json" : {"target" : 190 },
82
+ "2vcpu_512mb.json" : {"target" : 190 },
83
+ },
84
+ },
65
85
},
66
86
"aarch64" : {
67
- "2vcpu_256mb.json" : {"target" : 3 },
68
- "2vcpu_512mb.json" : {"target" : 3 },
87
+ "4.14" : {
88
+ "sync" : {
89
+ "2vcpu_256mb.json" : {"target" : 2 },
90
+ "2vcpu_512mb.json" : {"target" : 2 },
91
+ }
92
+ },
93
+ "5.10" : {
94
+ "sync" : {
95
+ "2vcpu_256mb.json" : {"target" : 2 },
96
+ "2vcpu_512mb.json" : {"target" : 2 },
97
+ },
98
+ "async" : {
99
+ "2vcpu_256mb.json" : {"target" : 125 },
100
+ "2vcpu_512mb.json" : {"target" : 130 },
101
+ },
102
+ },
69
103
},
70
104
}
71
105
@@ -88,9 +122,11 @@ def snapshot_create_measurements(vm_type, snapshot_type):
88
122
return [latency ]
89
123
90
124
91
- def snapshot_resume_measurements (vm_type ):
125
+ def snapshot_resume_measurements (vm_type , io_engine ):
92
126
"""Define measurements for snapshot resume tests."""
93
- load_latency = LOAD_LATENCY_BASELINES [platform .machine ()][vm_type ]
127
+ load_latency = LOAD_LATENCY_BASELINES [platform .machine ()][
128
+ get_kernel_version (level = 1 )
129
+ ][io_engine ][vm_type ]
94
130
95
131
latency = types .MeasurementDef .create_measurement (
96
132
"latency" ,
@@ -278,6 +314,7 @@ def _test_snapshot_resume_latency(context):
278
314
vm_builder = context .custom ["builder" ]
279
315
snapshot_type = context .custom ["snapshot_type" ]
280
316
file_dumper = context .custom ["results_file_dumper" ]
317
+ io_engine = context .custom ["io_engine" ]
281
318
diff_snapshots = snapshot_type == SnapshotType .DIFF
282
319
283
320
logger .info (
@@ -302,6 +339,7 @@ def _test_snapshot_resume_latency(context):
302
339
config = context .microvm ,
303
340
diff_snapshots = diff_snapshots ,
304
341
use_ramdisk = True ,
342
+ io_engine = io_engine ,
305
343
)
306
344
basevm = vm_instance .vm
307
345
basevm .start ()
@@ -341,7 +379,8 @@ def _test_snapshot_resume_latency(context):
341
379
func_kwargs = {},
342
380
)
343
381
eager_map (
344
- cons .set_measurement_def , snapshot_resume_measurements (context .microvm .name ())
382
+ cons .set_measurement_def ,
383
+ snapshot_resume_measurements (context .microvm .name (), io_engine .lower ()),
345
384
)
346
385
347
386
st_core .add_pipe (producer = prod , consumer = cons , tag = context .microvm .name ())
@@ -360,6 +399,7 @@ def _test_older_snapshot_resume_latency(context):
360
399
logger = context .custom ["logger" ]
361
400
snapshot_type = context .custom ["snapshot_type" ]
362
401
file_dumper = context .custom ["results_file_dumper" ]
402
+ io_engine = context .custom ["io_engine" ]
363
403
364
404
firecracker = context .firecracker
365
405
jailer = firecracker .jailer ()
@@ -410,7 +450,8 @@ def _test_older_snapshot_resume_latency(context):
410
450
func_kwargs = {},
411
451
)
412
452
eager_map (
413
- cons .set_measurement_def , snapshot_resume_measurements (context .microvm .name ())
453
+ cons .set_measurement_def ,
454
+ snapshot_resume_measurements (context .microvm .name (), io_engine .lower ()),
414
455
)
415
456
416
457
st_core .add_pipe (producer = prod , consumer = cons , tag = context .microvm .name ())
@@ -439,8 +480,8 @@ def test_snapshot_create_full_latency(
439
480
# - Rootfs: Ubuntu 18.04
440
481
# - Microvm: 2vCPU with 256/512 MB RAM
441
482
# TODO: Multiple microvm sizes must be tested in the async pipeline.
442
- microvm_artifacts = ArtifactSet (artifacts .microvms (keyword = "2vcpu_512mb " ))
443
- microvm_artifacts .insert (artifacts .microvms (keyword = "2vcpu_256mb " ))
483
+ microvm_artifacts = ArtifactSet (artifacts .microvms (keyword = "2vcpu_256mb " ))
484
+ microvm_artifacts .insert (artifacts .microvms (keyword = "2vcpu_512mb " ))
444
485
kernel_artifacts = ArtifactSet (artifacts .kernels ())
445
486
disk_artifacts = ArtifactSet (artifacts .disks (keyword = "ubuntu" ))
446
487
@@ -479,8 +520,8 @@ def test_snapshot_create_diff_latency(
479
520
# - Rootfs: Ubuntu 18.04
480
521
# - Microvm: 2vCPU with 256/512 MB RAM
481
522
# TODO: Multiple microvm sizes must be tested in the async pipeline.
482
- microvm_artifacts = ArtifactSet (artifacts .microvms (keyword = "2vcpu_512mb " ))
483
- microvm_artifacts .insert (artifacts .microvms (keyword = "2vcpu_256mb " ))
523
+ microvm_artifacts = ArtifactSet (artifacts .microvms (keyword = "2vcpu_256mb " ))
524
+ microvm_artifacts .insert (artifacts .microvms (keyword = "2vcpu_512mb " ))
484
525
kernel_artifacts = ArtifactSet (artifacts .kernels ())
485
526
disk_artifacts = ArtifactSet (artifacts .disks (keyword = "ubuntu" ))
486
527
@@ -504,7 +545,10 @@ def test_snapshot_create_diff_latency(
504
545
test_matrix .run_test (_test_snapshot_create_latency )
505
546
506
547
507
- def test_snapshot_resume_latency (network_config , bin_cloner_path , results_file_dumper ):
548
+ @pytest .mark .parametrize ("io_engine" , ENGINES )
549
+ def test_snapshot_resume_latency (
550
+ network_config , bin_cloner_path , results_file_dumper , io_engine
551
+ ):
508
552
"""
509
553
Test scenario: Snapshot load performance measurement.
510
554
@@ -518,8 +562,8 @@ def test_snapshot_resume_latency(network_config, bin_cloner_path, results_file_d
518
562
# - Rootfs: Ubuntu 18.04
519
563
# - Microvm: 2vCPU with 256/512 MB RAM
520
564
# TODO: Multiple microvm sizes must be tested in the async pipeline.
521
- microvm_artifacts = ArtifactSet (artifacts .microvms (keyword = "2vcpu_512mb " ))
522
- microvm_artifacts .insert (artifacts .microvms (keyword = "2vcpu_256mb " ))
565
+ microvm_artifacts = ArtifactSet (artifacts .microvms (keyword = "2vcpu_256mb " ))
566
+ microvm_artifacts .insert (artifacts .microvms (keyword = "2vcpu_512mb " ))
523
567
524
568
kernel_artifacts = ArtifactSet (artifacts .kernels ())
525
569
disk_artifacts = ArtifactSet (artifacts .disks (keyword = "ubuntu" ))
@@ -533,6 +577,7 @@ def test_snapshot_resume_latency(network_config, bin_cloner_path, results_file_d
533
577
"snapshot_type" : SnapshotType .FULL ,
534
578
"name" : "resume_latency" ,
535
579
"results_file_dumper" : results_file_dumper ,
580
+ "io_engine" : io_engine ,
536
581
}
537
582
538
583
# Create the test matrix.
@@ -544,7 +589,8 @@ def test_snapshot_resume_latency(network_config, bin_cloner_path, results_file_d
544
589
test_matrix .run_test (_test_snapshot_resume_latency )
545
590
546
591
547
- def test_older_snapshot_resume_latency (bin_cloner_path , results_file_dumper ):
592
+ @pytest .mark .parametrize ("io_engine" , ENGINES )
593
+ def test_older_snapshot_resume_latency (bin_cloner_path , results_file_dumper , io_engine ):
548
594
"""
549
595
Test scenario: Older snapshot load performance measurement.
550
596
@@ -570,6 +616,7 @@ def test_older_snapshot_resume_latency(bin_cloner_path, results_file_dumper):
570
616
"snapshot_type" : SnapshotType .FULL ,
571
617
"name" : "old_snapshot_resume_latency" ,
572
618
"results_file_dumper" : results_file_dumper ,
619
+ "io_engine" : io_engine ,
573
620
}
574
621
575
622
# Create the test matrix.
0 commit comments