azcopy benchmarkazcopy benchmark

通过将测试数据上传到指定目标或从指定目标下载测试数据来运行性能基准检验。Runs a performance benchmark by uploading or downloading test data to or from a specified destination. 对于上传,测试数据是自动生成的。For uploads, the test data is automatically generated.

基准检验命令运行与“copy”命令相同的过程,区别在于:The benchmark command runs the same process as 'copy', except that:

  • 基准检验并非同时需要源参数和目标参数,而只需要其中一个。Instead of requiring both source and destination parameters, benchmark takes just one. 这是你要向其上传数据或从中下载数据的 Blob 容器、Azure 文件存储共享或 Azure Data Lake Storage Gen2 文件系统。This is the blob container, Azure Files Share, or Azure Data Lake Storage Gen2 file system that you want to upload to or download from.

  • “mode”参数说明 AzCopy 是应该测试向给定目标的上传还是从给定目标的下载。The 'mode' parameter describes whether AzCopy should test uploads to or downloads from given target. 有效值为“上传”和“下载”。Valid values are 'Upload' and 'Download'. 默认值为“上传”。Default value is 'Upload'.

  • 对于上传基准检验,有效负载通过命令行参数来描述,这些参数控制自动生成的文件的数量和这些文件的重要性。For upload benchmarks, the payload is described by command-line parameters, which control how many files are autogenerated and how significant the files are. 生成过程完全在内存中进行。The generation process takes place entirely in memory. 不使用磁盘。Disk is not used.

  • 对于下载,有效负载包含源中已存在的任何文件。For downloads, the payload consists of whichever files already exist at the source. (如果需要,请参阅下面关于如何生成测试文件的示例)。(See example below about how to generate test files if needed).

  • 仅支持几个可用于 copy 命令的可选参数。Only a few of the optional parameters that are available to the copy command are supported.

  • 将会度量和报告其他诊断信息。Additional diagnostics are measured and reported.

  • 对于上传,默认行为是在测试运行结束时删除传输的数据。For uploads, the default behavior is to delete the transferred data at the end of the test run. 对于下载,数据永远不会保存在本地。For downloads, the data is never saved locally.

基准模式会自行调整为能够提供最大吞吐量的并行 TCP 连接数。Benchmark mode will automatically tune itself to the number of parallel TCP connections that gives the maximum throughput. 它会在结尾处显示该数字。It will display that number at the end. 若要防止自动优化,请将 AZCOPY_CONCURRENCY_VALUE 环境变量设置为特定的连接数。To prevent autotuning, set the AZCOPY_CONCURRENCY_VALUE environment variable to a specific number of connections.

支持所有常用的身份验证类型。All the usual authentication types are supported. 但通常情况下,进行上传基准检验最方便的方法是创建一个包含 SAS 令牌的空容器并使用 SAS 身份验证。However, the most convenient approach for benchmarking upload is typically to create an empty container with a SAS token and use SAS authentication. (下载模式要求目标容器中存在一组测试数据。)(Download mode requires a set of test data to be present in the target container.)

示例Examples

azcopy benchmark [destination] [flags]

使用默认参数运行基准测试(适用于对高达 1 Gbps 的网络进行基准测试):Run a benchmark test with default parameters (suitable for benchmarking networks up to 1 Gbps):'

azcopy bench "https://[account].blob.core.chinacloudapi.cn/[container]?<SAS>"

运行一个上传 100 个文件的基准测试,每个文件的大小为 2 GiB:(适用于在快速网络(例如 10 Gbps 的网络)上进行基准测试):Run a benchmark test that uploads 100 files, each 2 GiB in size: (suitable for benchmarking on a fast network, for example, 10 Gbps):'

azcopy bench "https://[account].blob.core.chinacloudapi.cn/[container]?<SAS>" --file-count 100 --size-per-file 2G

运行基准测试,但使用 50,000 个文件,每个文件的大小为 8 MiB,并计算其 MD5 哈希值(使用的方式与 --put-md5 标记在 copy 命令中使用的相同)。Run a benchmark test but use 50,000 files, each 8 MiB in size and compute their MD5 hashes (in the same way that the --put-md5 flag does this in the copy command). 进行基准测试时使用 --put-md5 的目的是测试 MD5 计算是否会影响所选文件计数和大小的吞吐量:The purpose of --put-md5 when benchmarking is to test whether MD5 computation affects throughput for the selected file count and size:

azcopy bench --mode='Upload' "https://[account].blob.core.chinacloudapi.cn/[container]?<SAS>" --file-count 50000 --size-per-file 8M --put-md5

运行从目标下载现有文件的基准检验测试Run a benchmark test that downloads existing files from a target

azcopy bench --mode='Download' "https://[account].blob.core.chinacloudapi.cn/[container]?<SAS>"

运行不会删除传输的文件的上传。Run an upload that does not delete the transferred files. (这些文件之后可用作下载测试的有效负载)(These files can then serve as the payload for a download test)

azcopy bench "https://[account].blob.core.chinacloudapi.cn/[container]?<SAS>" --file-count 100 --delete-test-data=false

选项Options

--blob-type 字符串 定义目标中的 Blob 类型。--blob-type string Defines the type of blob at the destination. 用于允许对不同的 Blob 类型进行基准测试。Used to allow benchmarking different blob types. 与 copy 命令中具有相同名称的参数相同(默认为“Detect”)。Identical to the same-named parameter in the copy command (default "Detect").

--block-size-mb 浮点数 使用此块大小(以 MiB 为单位)。--block-size-mb float Use this block size (specified in MiB). 默认值根据文件大小自动计算。Default is automatically calculated based on file size. 允许使用小数,例如 0.25。Decimal fractions are allowed - for example, 0.25. 与 copy 命令中具有相同名称的参数相同。Identical to the same-named parameter in the copy command.

--check-length - 传输后检查目标上的文件长度。--check-length Check the length of a file on the destination after the transfer. 如果源与目标之间不匹配,则将传输标记为失败。If there is a mismatch between source and destination, the transfer is marked as failed. (默认值为 true)(default true)

--delete-test-data 如果为 true,则会在基准测试运行结束时删除基准数据。--delete-test-data If true, the benchmark data will be deleted at the end of the benchmark run. 将它设置为 false 的前提是需在目标中保留数据,例如,将它用于基准模式之外的手动测试(默认为 true)。Set it to false if you want to keep the data at the destination - for example, to use it for manual tests outside benchmark mode (default true).

--file-count - uint。--file-count uint. 要使用的自动生成的数据文件数(默认为 100)。The number of autogenerated data files to use (default 100).

--help - bench 命令的帮助--help Help for bench

--log-level 字符串 定义日志文件的日志详细程度,可用级别:INFO(所有请求/响应)、WARNING(响应缓慢)、ERROR(仅限失败的请求)和 NONE(无输出日志)。--log-level string Define the log verbosity for the log file, available levels: INFO(all requests/responses), WARNING(slow responses), ERROR(only failed requests), and NONE(no output logs). (默认值为“INFO”)(default "INFO")

--mode - 字符串。定义 AzCopy 是应该测试向此目标的上传还是从给定目标的下载。--mode string Defines if Azcopy should test uploads or downloads from this target. 有效值为“上传”和“下载”。Valid values are 'upload' and 'download'. 默认选项为“上传”。Defaulted option is 'upload'. (默认值“上传”)(default 'upload')

--number-of-folders - uint。如果大于 0,则创建文件夹来划分数据。--number-of-folders uint If larger than 0, create folders to divide up the data.

--put-md5 创建每个文件的 MD5 哈希,并将该哈希另存为目标 Blob/文件的 Content-MD5 属性。--put-md5 Create an MD5 hash of each file, and save the hash as the Content-MD5 property of the destination blob/file. (默认不会创建哈希。)与 copy 命令中具有相同名称的参数相同。(By default the hash is NOT created.) Identical to the same-named parameter in the copy command.

--size-per-file - 字符串。每个自动生成的数据文件的大小。--size-per-file string Size of each autogenerated data file. 必须是一个数字,后面紧跟 K、M 或 G。例如,Must be a number immediately followed by K, M, or G. E.g. 12k 或 200G(默认为“250M”)。12k or 200G (default "250M").

从父命令继承的选项Options inherited from parent commands

--cap-mbps float - 限制传输速率(以兆位/秒为单位)。--cap-mbps float Caps the transfer rate, in megabits per second. 瞬间吞吐量可能与上限略有不同。Moment-by-moment throughput might vary slightly from the cap. 如果此选项设置为零,或者省略,则吞吐量不受限制。If this option is set to zero, or it is omitted, the throughput isn't capped.

--output-type 字符串 命令输出的格式。--output-type string Format of the command's output. 选项包括:text、json。The choices include: text, json. 默认值为“text”。The default value is 'text'. (默认值为“text”)。(default "text").

--trusted-microsoft-suffixes string 指定可向其中发送 Azure Active Directory 登录令牌的其他域后缀。--trusted-microsoft-suffixes string Specifies additional domain suffixes where Azure Active Directory login tokens may be sent. 默认值为“.core.windows.net;.core.chinacloudapi.cn;.core.cloudapi.de;.core.usgovcloudapi.net” 。The default is '.core.windows.net;.core.chinacloudapi.cn;.core.cloudapi.de;.core.usgovcloudapi.net'. 此处列出的任何内容都会添加到默认值。Any listed here are added to the default. 为安全起见,应只在此处放置 Azure 域。For security, you should only put Azure domains here. 用分号分隔多个条目。Separate multiple entries with semi-colons.

另请参阅See also