@@ -90,8 +90,8 @@ def get_snap_restore_latency(
90
90
rootfs ,
91
91
vcpus ,
92
92
mem_size ,
93
- nets = 1 ,
94
- blocks = 1 ,
93
+ nets = 3 ,
94
+ blocks = 3 ,
95
95
all_devices = False ,
96
96
iterations = 10 ,
97
97
):
@@ -186,94 +186,35 @@ def consume_output(cons, result):
186
186
187
187
188
188
@pytest .mark .nonci
189
- @pytest .mark .parametrize ("vcpu_count" , [1 , 2 , 4 , 8 , 10 ])
190
- def test_snapshot_scaling_vcpus (
191
- bin_cloner_path , microvm_factory , rootfs , guest_kernel , vcpu_count , st_core
189
+ @pytest .mark .parametrize (
190
+ "mem, vcpus" ,
191
+ [
192
+ (128 , 1 ),
193
+ (1024 , 1 ),
194
+ (2048 , 2 ),
195
+ (4096 , 3 ),
196
+ (6144 , 4 ),
197
+ (8192 , 5 ),
198
+ (10240 , 6 ),
199
+ (12288 , 7 ),
200
+ ],
201
+ )
202
+ def test_snapshot_scaling (
203
+ bin_cloner_path , microvm_factory , rootfs , guest_kernel , st_core , mem , vcpus
192
204
):
193
- """Restore snapshots with variable vcpu count."""
194
- guest_config = f"{ vcpu_count } vcpu_{ BASE_MEM_SIZE_MIB } mb"
195
- env_id = f"{ guest_kernel .name ()} /{ rootfs .name ()} /{ guest_config } "
196
- st_prod = st .producer .LambdaProducer (
197
- func = get_snap_restore_latency ,
198
- func_kwargs = {
199
- "vm_builder" : MicrovmBuilder (bin_cloner_path ),
200
- "microvm_factory" : microvm_factory ,
201
- "guest_kernel" : guest_kernel ,
202
- "rootfs" : rootfs ,
203
- "vcpus" : vcpu_count ,
204
- "mem_size" : BASE_MEM_SIZE_MIB ,
205
- },
206
- )
207
- st_cons = default_lambda_consumer (env_id , WORKLOAD )
208
- st_core .add_pipe (st_prod , st_cons , f"{ env_id } /{ WORKLOAD } " )
209
- st_core .name = TEST_ID
210
- st_core .custom ["guest_config" ] = guest_config
211
- st_core .run_exercise ()
205
+ """
206
+ Restores snapshots with vcpu/memory configuration, roughly scaling according to mem = (vcpus - 1) * 2048MB,
207
+ which resembles firecracker production setups.
212
208
213
209
214
- # mem_exponent=7 takes around 100s
215
- @pytest .mark .nonci
216
- @pytest .mark .timeout (10 * 60 )
217
- @pytest .mark .parametrize ("mem_exponent" , range (1 , 8 ))
218
- def test_snapshot_scaling_mem (
219
- bin_cloner_path , microvm_factory , rootfs , guest_kernel , mem_exponent , st_core
220
- ):
221
- """Restore snapshots with variable memory size."""
222
- mem_mib = BASE_MEM_SIZE_MIB * (2 ** mem_exponent )
223
- guest_config = f"{ BASE_VCPU_COUNT } vcpu_{ mem_mib } mb"
224
- env_id = f"{ guest_kernel .name ()} /{ rootfs .name ()} /{ guest_config } "
225
- st_prod = st .producer .LambdaProducer (
226
- func = get_snap_restore_latency ,
227
- func_kwargs = {
228
- "vm_builder" : MicrovmBuilder (bin_cloner_path ),
229
- "microvm_factory" : microvm_factory ,
230
- "guest_kernel" : guest_kernel ,
231
- "rootfs" : rootfs ,
232
- "vcpus" : BASE_VCPU_COUNT ,
233
- "mem_size" : mem_mib ,
234
- },
235
- )
236
- st_cons = default_lambda_consumer (env_id , WORKLOAD )
237
- st_core .add_pipe (st_prod , st_cons , f"{ env_id } /{ WORKLOAD } " )
238
- st_core .name = TEST_ID
239
- st_core .custom ["guest_config" ] = guest_config
240
- st_core .run_exercise ()
241
-
242
-
243
- @pytest .mark .nonci
244
- @pytest .mark .parametrize ("net_count" , range (1 , 4 ))
245
- def test_snapshot_scaling_net (
246
- bin_cloner_path , microvm_factory , rootfs , guest_kernel , st_core , net_count
247
- ):
248
- """Restore snapshots with variable net device count."""
249
- guest_config = f"{ BASE_NET_COUNT + net_count } net_dev"
250
- env_id = f"{ guest_kernel .name ()} /{ rootfs .name ()} /{ guest_config } "
251
- st_prod = st .producer .LambdaProducer (
252
- func = get_snap_restore_latency ,
253
- func_kwargs = {
254
- "vm_builder" : MicrovmBuilder (bin_cloner_path ),
255
- "microvm_factory" : microvm_factory ,
256
- "guest_kernel" : guest_kernel ,
257
- "rootfs" : rootfs ,
258
- "vcpus" : BASE_VCPU_COUNT ,
259
- "mem_size" : BASE_MEM_SIZE_MIB ,
260
- "nets" : BASE_NET_COUNT + net_count ,
261
- },
262
- )
263
- st_cons = default_lambda_consumer (env_id , WORKLOAD )
264
- st_core .add_pipe (st_prod , st_cons , f"{ env_id } /{ WORKLOAD } " )
265
- st_core .name = TEST_ID
266
- st_core .custom ["guest_config" ] = guest_config
267
- st_core .run_exercise ()
210
+ """
268
211
212
+ # The guest kernel does not "participate" in snapshot restore, so just pick some
213
+ # arbitrary one
214
+ if "4.14" not in guest_kernel .name ():
215
+ pytest .skip ()
269
216
270
- @pytest .mark .nonci
271
- @pytest .mark .parametrize ("block_count" , range (1 , 4 ))
272
- def test_snapshot_scaling_block (
273
- bin_cloner_path , microvm_factory , rootfs , guest_kernel , st_core , block_count
274
- ):
275
- """Restore snapshots with variable block device count."""
276
- guest_config = f"{ BASE_BLOCK_COUNT + block_count } block_dev"
217
+ guest_config = f"{ vcpus } vcpu_{ mem } mb"
277
218
env_id = f"{ guest_kernel .name ()} /{ rootfs .name ()} /{ guest_config } "
278
219
st_prod = st .producer .LambdaProducer (
279
220
func = get_snap_restore_latency ,
@@ -282,9 +223,8 @@ def test_snapshot_scaling_block(
282
223
"microvm_factory" : microvm_factory ,
283
224
"guest_kernel" : guest_kernel ,
284
225
"rootfs" : rootfs ,
285
- "vcpus" : BASE_VCPU_COUNT ,
286
- "mem_size" : BASE_MEM_SIZE_MIB ,
287
- "blocks" : BASE_BLOCK_COUNT + block_count ,
226
+ "vcpus" : vcpus ,
227
+ "mem_size" : mem ,
288
228
},
289
229
)
290
230
st_cons = default_lambda_consumer (env_id , WORKLOAD )
@@ -299,6 +239,12 @@ def test_snapshot_all_devices(
299
239
bin_cloner_path , microvm_factory , rootfs , guest_kernel , st_core
300
240
):
301
241
"""Restore snapshots with one of each devices."""
242
+
243
+ # The guest kernel does not "participate" in snapshot restore, so just pick some
244
+ # arbitrary one
245
+ if "4.14" not in guest_kernel .name ():
246
+ pytest .skip ()
247
+
302
248
guest_config = "all_dev"
303
249
env_id = f"{ guest_kernel .name ()} /{ rootfs .name ()} /{ guest_config } "
304
250
st_prod = st .producer .LambdaProducer (
@@ -308,6 +254,8 @@ def test_snapshot_all_devices(
308
254
"microvm_factory" : microvm_factory ,
309
255
"guest_kernel" : guest_kernel ,
310
256
"rootfs" : rootfs ,
257
+ "nets" : 1 ,
258
+ "blocks" : 1 ,
311
259
"vcpus" : BASE_VCPU_COUNT ,
312
260
"mem_size" : BASE_MEM_SIZE_MIB ,
313
261
"all_devices" : True ,
0 commit comments