Skip to content

Commit

Permalink
Add nfs storage performance testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
dsrivastavv committed Jan 14, 2022
1 parent 3213915 commit 3c2ba8f
Showing 1 changed file with 200 additions and 2 deletions.
202 changes: 200 additions & 2 deletions microsoft/testsuites/performance/storageperf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Any, List
from pathlib import PurePosixPath
from typing import Any, List, cast

from assertpy import assert_that

Expand All @@ -16,8 +17,12 @@
)
from lisa.environment import Environment
from lisa.features import Disk
from lisa.features.network_interface import Sriov, Synthetic
from lisa.node import RemoteNode
from lisa.notifier import DiskPerformanceMessage, DiskSetupType, DiskType
from lisa.tools import Fdisk, Lscpu, Mdadm
from lisa.operating_system import SLES, Debian, Redhat
from lisa.tools import FIOMODES, NFS, Fdisk, FileSystem, Fio, Lscpu, Mdadm, Mkfs, Mount
from lisa.util import SkippedException
from microsoft.testsuites.performance.common import (
handle_and_send_back_results,
run_perf_test,
Expand Down Expand Up @@ -125,6 +130,199 @@ def perf_premium_datadisks_io(self, node: Node, environment: Environment) -> Non
max_iodepth=64,
)

@TestCaseMetadata(
description="""
This test case uses fio to test performance of nfs server over TCP with
VM's initialized with SRIOV network interface.
""",
priority=3,
timeout=TIME_OUT,
requirement=simple_requirement(
min_count=2,
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=12),
),
network_interface=Sriov(),
),
)
def perf_storage_over_nfs_sriov_tcp_4k(self, environment: Environment) -> None:
self._perf_nfs(
environment,
test_case_name="perf_storage_over_nfs_sriov_tcp_4k",
)

@TestCaseMetadata(
description="""
This test case uses fio to test performance of nfs server over UDP with
VM's initialized with SRIOV network interface.
""",
priority=3,
timeout=TIME_OUT,
requirement=simple_requirement(
min_count=2,
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=12),
),
network_interface=Sriov(),
),
)
def perf_storage_over_nfs_sriov_udp_4k(self, environment: Environment) -> None:
self._perf_nfs(
environment,
test_case_name="perf_storage_over_nfs_sriov_udp_4k",
protocol="udp",
)

@TestCaseMetadata(
description="""
This test case uses fio to test performance of nfs server over TCP with
VM's initialized with synthetic network interface.
""",
priority=3,
timeout=TIME_OUT,
requirement=simple_requirement(
min_count=2,
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=12),
),
network_interface=Synthetic(),
),
)
def perf_storage_over_nfs_synthetic_tcp_4k(self, environment: Environment) -> None:
self._perf_nfs(
environment,
test_case_name="perf_storage_over_nfs_synthetic_tcp_4k",
)

@TestCaseMetadata(
description="""
This test case uses fio to test performance of nfs server over UDP with
VM's initialized with synthetic network interface.
""",
priority=3,
timeout=TIME_OUT,
requirement=simple_requirement(
min_count=2,
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=12),
),
network_interface=Synthetic(),
),
)
def perf_storage_over_nfs_synthetic_udp_4k(self, environment: Environment) -> None:
self._perf_nfs(
environment,
test_case_name="perf_storage_over_nfs_synthetic_udp_4k",
protocol="udp",
)

def _perf_nfs(
self,
environment: Environment,
test_case_name: str,
server_raid_disk_name: str = "/dev/md0",
server_raid_disk_mount_dir: str = "/mnt/nfs_share",
client_nfs_mount_dir: str = "/mnt/nfs_client_share",
protocol: str = "tcp",
filename: str = "fiodata",
block_size: int = 4,
start_iodepth: int = 1,
max_iodepth: int = 1024,
) -> None:
server_node = cast(RemoteNode, environment.nodes[0])
client_node = cast(RemoteNode, environment.nodes[1])

# Run test only on Debian, SLES and Redhat distributions
if (
not isinstance(server_node.os, Redhat)
and not isinstance(server_node.os, Debian)
and not isinstance(server_node.os, SLES)
):
raise SkippedException(f"{server_node.os} not supported")

# calculate the number of jobs to run. The max number of jobs is equal
# to the core count of the node.
num_jobs = []
core_count = client_node.tools[Lscpu].get_core_count()
for i in range(start_iodepth, max_iodepth + 1):
num_jobs.append(min(2 ** (i - 1), core_count))

# setup raid on server
server_data_disks = server_node.features[Disk].get_raw_data_disks()
server_data_disk_count = len(server_data_disks)
server_partition_disks = _format_disk(server_node, server_data_disks)
_stop_raid(server_node)
_make_raid(server_node, server_partition_disks)

# mount raid disk on server
server_node.shell.mkdir(
PurePosixPath(server_raid_disk_mount_dir), exist_ok=True
)
server_node.tools[Mkfs].format_disk(server_raid_disk_name, FileSystem.ext4)
server_node.tools[Mount].mount(
server_raid_disk_name, server_raid_disk_mount_dir, options="nobarrier"
)

# setup nfs on server
server_node.tools[NFS].setup_server(
[client_node.public_address], server_raid_disk_mount_dir
)

# setup raid on client
client_node.tools[NFS].setup_client(
server_node.public_address,
server_raid_disk_mount_dir,
client_nfs_mount_dir,
protocol,
)

# Run a dummy fio job on client to create required test files and
# transfer over network. If this step is skipped, it can impact
# the test result.
client_node.tools[Fio].launch(
name="prepare",
filename=filename,
mode=FIOMODES.read.name,
time=120,
size_gb=1024,
block_size="1M",
iodepth=128,
overwrite=True,
numjob=8,
cwd=PurePosixPath(client_nfs_mount_dir),
)

# run fio test
fio_messages: List[DiskPerformanceMessage] = run_perf_test(
client_node,
start_iodepth,
max_iodepth,
filename,
num_jobs=num_jobs,
block_size=block_size,
size_gb=1024,
overwrite=True,
cwd=PurePosixPath(client_nfs_mount_dir),
)
handle_and_send_back_results(
core_count,
server_data_disk_count,
environment,
DiskSetupType.raid0,
DiskType.premiumssd,
test_case_name,
fio_messages,
block_size,
)

def _perf_premium_datadisks(
self,
node: Node,
Expand Down

0 comments on commit 3c2ba8f

Please sign in to comment.