Benchmark higher network bandwidth for VM instances Stay organized with collections Save and categorize content based on your preferences.
This document explains how to test per VM Tier_1 networking performanceby creating two VMs and streaming traffic back and forth to observenetwork performance. To take advantage of this feature, you must create your VMwithoperating systems thatsupport theGoogle Virtual NIC (gVNIC).Per VM Tier_1 networking performance requires larger VM sizes, so confirm youhave enoughCPU quota to create the VMs.
Before you begin
- Ensure that you are using a publicimage that supports gVNICorcreate a custom imagein your project.
- Verify that you created VPC firewall rules toallow ingress on port TCP:5001, or another port of your choosing, to allow for
iperfperformance testing. - Use iPerf version 2, not version 3, to perform the benchmarking.
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Setting up VMs for benchmarking
Create twon2-standard-64 vCPU machines with per VM Tier_1 networking performanceenabled and the highestmaximum transmission unit (MTU)setting. This gives your VMs up to 75 Gbps of maximum egress bandwidth(using internal IPs).
gcloud
To create an image, use thegcloud compute images create command.
gcloud compute images createIMAGE_NAME \ --project=PROJECT_ID \ --source-image-family=SOURCE_IMAGE_FAMILY \ --source-image-project=SOURCE_IMAGE_PROJECT \ --guest-os-features=GVNIC
Replace the following:
- PROJECT_ID: the name of your project.
- IMAGE_NAME: the name of the image that you want to create.
- SOURCE_IMAGE_FAMILY: required version of a public image. For this test, use
ubuntu-2004-lts. - SOURCE_IMAGE_PROJECT: the name of the projectthat contains the source image. For this test, use
ubuntu-os-cloud.
Example
gcloud compute images create benchmark-image-test \ --project=my-project \ --source-image-family=ubuntu-2004-lts \ --source-image-project=ubuntu-os-cloud \ --guest-os-features=GVNICCreate an auto mode VPC network that uses the maximum MTU setting:
gcloud compute networks createNETWORK_NAME \ --project=PROJECT_ID \ --subnet-mode=AUTO --mtu=8896
Replace the following:
- PROJECT_ID: the name of your project.
- NETWORK_NAME: a name for the network.
Create two identical instances:
gcloud compute instances create \VM_NAME_1VM_NAME_2 \ --project=PROJECT_ID \ --zone=ZONE \ --machine-type=n2-standard-64 \ --image=projects/PROJECT_NAME/global/images/IMAGE_NAME \ --network=NETWORK_NAME \ --network-interface=nic-type=GVNIC \ --network-performance-configs=total-egress-bandwidth-tier=TIER_1
Replace the following:
- VM_NAME_1,VM_NAME_2:the names of the VM instances that you want to create.
- PROJECT_ID: your project name.
- ZONE: your VM's zone. Both VMs must reside in the same zone.
- PROJECT_NAME/global/images/IMAGE_NAME: yourproject name and the image name.
- NETWORK_NAME: the name of the networkyou configured with the maximum MTU setting.
Performing the benchmark
Your two VMs must reside in the same zone and on the sameVPC network. During thebenchmark, these two VMs conduct bi-directional testing of theVPC network path.
Verify the MTU setting
Confirm the Virtual Private Cloud (VPC) network has the maximum MTU settingconfigured by usingifconfig in the guest OS of one of the VMs.
In the terminal window, run the following command:
/sbin/ifconfig | grep mtu
The reported MTU should be 8896.
ens4: flags=4163 mtu 8896 lo: flags=73 mtu 65536
Verify the VM configuration
Confirm the virtual machines have Tier_1 networking enabled byexamining the virtual machine properties.
gcloud
To view the instances, use thegcloud compute instances describe command.
gcloud compute instances describeVM_NAME_1 \ --project=PROJECT_ID \ --zone=ZONE \ --format="text(networkPerformanceConfig)"
gcloud compute instances describeVM_NAME_2 \ --project=PROJECT_ID \ --zone=ZONE \ --format="text(networkPerformanceConfig)"
Replace the following:
- VM_NAME_1: the names of the VM instance that you want to view.
- VM_NAME_2: the names of the VM instance that you want to view.
- PROJECT_ID: your project name.
- ZONE: your VM's zone. Both VMs must reside in the same zone.
In the response you should see the following:
networkPerformanceConfig.totalEgressBandwidthTier: TIER_1
Use iPerf to perform the benchmark on Debian-based systems
Note: Ensure that you are using iPerf version 2 and not version 3; iPerfversion 3 does not support multi-threading (by design) and can have performanceimplications in your results when running multiple streams.gcloud
If you haven't already done so, complete the steps inSetting up VMs for benchmarking.
After both VMs are running, use SSH to connect to one of the VMs.
gcloud compute sshVM_NAME_1 \ --project=PROJECT_ID
Replace the following:
- VM_NAME_1: the name of your first VM.
- PROJECT_ID: your project name.
On the first VM, complete the following steps:
Install
iperf.sudo apt-get update && sudo apt-get install iperf
Get the internal IP address for this VM. Make note of the internal IPaddress for later use.
ip a
Start up the iPerf server.
iperf -s
This starts up a server listening for connections in order to performthe benchmark. Leave the iPerf server running for the duration of thetest.
In a separate client terminal, connect to the second VM using SSH.
gcloud compute sshVM_NAME_2 \ --project=PROJECT_ID
Replace the following:
- VM_NAME_2: the name of your second VM.
- PROJECT_ID: your project name.
On the second VM, complete the following steps:
Install iPerf.
sudo apt-get update && sudo apt-get install iperf
Run the iperf test and specify the first VM's IP address as the target.
Note: The order of the arguments is important.iperf -t 30 -c internal_ip_of_instance_1 -P 16
This executes a 30-second test. If iPerf is not able to reach theother VM you, might need to adjust the network orfirewall settings on the VMs or perhapsin the Google Cloud console.
Your results should look something like the following example.It shows the 75 Gbps egress bandwidth limit for
n2-standard-64withTier_1 networkingenabled, exceeding the default 32 Gbps egress bandwidth limit.------------------------------------------------------------Client connecting to 10.128.0.10, TCP port 5001TCP window size: 1.59 MByte (default)------------------------------------------------------------[ 12] local 10.128.0.11 port 57722 connected with 10.128.0.10 port 5001[ 11] local 10.128.0.11 port 57720 connected with 10.128.0.10 port 5001[ 16] local 10.128.0.11 port 57730 connected with 10.128.0.10 port 5001[ 6] local 10.128.0.11 port 57710 connected with 10.128.0.10 port 5001[ 13] local 10.128.0.11 port 57724 connected with 10.128.0.10 port 5001[ 8] local 10.128.0.11 port 57712 connected with 10.128.0.10 port 5001[ 9] local 10.128.0.11 port 57716 connected with 10.128.0.10 port 5001[ 14] local 10.128.0.11 port 57726 connected with 10.128.0.10 port 5001[ 15] local 10.128.0.11 port 57728 connected with 10.128.0.10 port 5001[ 10] local 10.128.0.11 port 57718 connected with 10.128.0.10 port 5001[ 4] local 10.128.0.11 port 57706 connected with 10.128.0.10 port 5001[ 5] local 10.128.0.11 port 57708 connected with 10.128.0.10 port 5001[ 3] local 10.128.0.11 port 57704 connected with 10.128.0.10 port 5001[ 17] local 10.128.0.11 port 57732 connected with 10.128.0.10 port 5001[ 7] local 10.128.0.11 port 57714 connected with 10.128.0.10 port 5001[ 18] local 10.128.0.11 port 57734 connected with 10.128.0.10 port 5001[ ID] Interval Transfer Bandwidth[ 12] 0.0-30.0 sec 7.63 GBytes 2.19 Gbits/sec[ 11] 0.0-30.0 sec 17.7 GBytes 5.07 Gbits/sec[ 16] 0.0-30.0 sec 9.15 GBytes 2.62 Gbits/sec[ 6] 0.0-30.0 sec 43.8 GBytes 12.6 Gbits/sec[ 13] 0.0-30.0 sec 23.6 GBytes 6.76 Gbits/sec[ 8] 0.0-30.0 sec 13.3 GBytes 3.80 Gbits/sec[ 9] 0.0-30.0 sec 9.29 GBytes 2.66 Gbits/sec[ 14] 0.0-30.0 sec 19.6 GBytes 5.62 Gbits/sec[ 15] 0.0-30.0 sec 12.5 GBytes 3.58 Gbits/sec[ 10] 0.0-30.0 sec 11.1 GBytes 3.19 Gbits/sec[ 4] 0.0-30.0 sec 19.0 GBytes 5.43 Gbits/sec[ 5] 0.0-30.0 sec 7.32 GBytes 2.10 Gbits/sec[ 3] 0.0-30.0 sec 8.78 GBytes 2.51 Gbits/sec[ 17] 0.0-30.0 sec 17.5 GBytes 5.02 Gbits/sec[ 7] 0.0-30.0 sec 33.4 GBytes 9.57 Gbits/sec[ 18] 0.0-30.0 sec 7.64 GBytes 2.19 Gbits/sec[SUM] 0.0-30.0 sec 261 GBytes 74.9 Gbits/sec
Remove resources after benchmark testing
Remove the resources you created during the benchmark testing to avoidcharges for the image and additional VMs.
gcloud
Use the
gcloud compute instances deletecommandto remove the instances you created for benchmark testing.gcloud compute instances delete \VM_NAME_1VM_NAME_2 \ --project=PROJECT_ID \ --zone=ZONE
Replace the following:
- VM_NAME_1,VM_NAME_2:the names of the two VM instances that you want to delete.
- PROJECT_ID: your project name.
- ZONE: your VM's zone. Both VMs should bein the same zone.
Use the
gcloud compute networks deletecommandto remove the network you created for benchmark testing.gcloud compute networks deleteNETWORK_NAME \ --project=PROJECT_ID
Replace the following:
- NETWORK_NAME:the name of the network that you want to delete.
- PROJECT_ID: your project name.
Use the
gcloud compute images deletecommandto remove the image you created for benchmark testing.gcloud compute images deleteIMAGE_NAME \ --project=PROJECT_ID
Replace the following:
- IMAGE_NAME: the name of the image that you want to delete.
- PROJECT_ID: your project name.
What's next
- Learn aboutTier_1 networking pricing.
- Reviewbandwidth tiersfor additional machine types.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.