Azure VM的加速網(wǎng)絡(luò)

Azure多種機(jī)型都配置了FPGA卡惕稻,這是硬件基礎(chǔ)再榄,可以實(shí)現(xiàn)網(wǎng)絡(luò)加速。

軟件上襟诸,VM 跳過了虛擬化層面的hypervisor瓦堵,直接和物理網(wǎng)卡的邏輯網(wǎng)卡通信。減少了對(duì)物理機(jī)CPU的占用歌亲,提高了效率菇用。

在重載的應(yīng)用中,網(wǎng)絡(luò)側(cè)占用CPU的資源大大減少陷揪,可以明顯提升應(yīng)用的流暢性惋鸥。當(dāng)然如果在輕載情況下,效果并不明顯悍缠。

加速網(wǎng)絡(luò)(Accelerated networking)支持的類型

加速網(wǎng)絡(luò)支持大多數(shù)具有2個(gè)或更多vCPU的通用和計(jì)算優(yōu)化實(shí)例大小卦绣。普通2個(gè)vCPU,有超線程技術(shù)的需要4個(gè)vCPU飞蚓。

具體實(shí)操

參考文檔:https://docs.microsoft.com/en-us/azure/virtual-network/create-vm-accelerated-networking-cli

Create resource group

$ az group create --name roy-fpga --location southeastasia

{
  "id": "/subscriptions/xxx/resourceGroups/roy-fpga",
  "location": "southeastasia",
  "managedBy": null,
  "name": "roy-fpga",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": null
}

Create vnet

$ az network vnet create -g roy-fpga -n roy-fpga-vnet --address-prefix 10.0.0.0/16 --subnet-name roy-fpga-subnet --subnet-prefix 10.0.0.0/24

{

  "newVNet": {
    "additionalProperties": {},
    "addressSpace": {
      "additionalProperties": {},
      "addressPrefixes": [
        "10.0.0.0/16"
      ]
    },
...
}

Create public ip

$ az network public-ip create --name roy-pip -g roy-fpga
{
  "publicIp": {
    "additionalProperties": {},
    "dnsSettings": null,
    "etag": "W/\"8681014a-1d63-41dd-8d36-3b7d0381c943\"",
....
  }
}

Create Nic

--accelerated-networking true 意思是網(wǎng)卡開啟加速網(wǎng)絡(luò)的功能

$ az network nic create \
-g roy-fpga \
> -n roy-pubnic \
> --vnet-name roy-fpga-vnet \
> --subnet roy-fpga-subnet \
> --accelerated-networking true \
> --public-ip-address roy-pip
{
  "NewNIC": {
    "additionalProperties": {},
    "dnsSettings": {
      "additionalProperties": {},
      "appliedDnsServers": [],
      "dnsServers": [],
      "internalDnsNameLabel": null,
      "internalDomainNameSuffix": "[50ap2osglnpe5ouvy5u5gwu21d.ix.internal.cloudapp.net](http://50ap2osglnpe5ouvy5u5gwu21d.ix.internal.cloudapp.net)",
      "internalFqdn": null
    },
    "enableAcceleratedNetworking": true,
    "enableIpForwarding": false,
...
}

Create VM

$ az vm create -g roy-fpga -n roy-pub-vm --image OpenLogic:CentOS:7.4:latest --size Standard_D4s_v3 --nics roy-pubnic --generate-ssh-keys
{
  "fqdns": "",
  "id": "/subscriptions/xxx/resourceGroups/roy-fpga/providers/[Microsoft.Compute/virtualMachines/roy-pub-vm](http://Microsoft.Compute/virtualMachines/roy-pub-vm)",
  "location": "southeastasia",
  "macAddress": "00-0D-3A-A2-D9-33",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.4",
  "publicIpAddress": "168.63.232.200",
  "resourceGroup": "roy-fpga",
  "zones": ""
}

Check on VM

[royzeng@roy-pub-vm ~]$ lspci
0000:00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) (rev 03)
0000:00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 01)
0000:00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
0000:00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 02)
0000:00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA
0001:00:02.0 Ethernet controller: Mellanox Technologies MT27500/MT27520 Family [ConnectX-3/ConnectX-3 Pro Virtual Function]

發(fā)現(xiàn)了:Ethernet controller: Mellanox Technologies
這是Mellanox網(wǎng)卡的VF接口滤港,說明帶有加速網(wǎng)絡(luò)的VM就創(chuàng)建好了。

軟件測(cè)速

從github下載軟件來測(cè)速

[royzeng@roy-pub-vm ~]$ git clone https://github.com/sivel/speedtest-cli.git
Cloning into 'speedtest-cli'...
remote: Enumerating objects: 1137, done.
remote: Total 1137 (delta 0), reused 0 (delta 0), pack-reused 1137
Receiving objects: 100% (1137/1137), 319.11 KiB | 293.00 KiB/s, done.
Resolving deltas: 100% (664/664), done.
[royzeng@roy-pub-vm ~]$ cd speedtest-cli/
[royzeng@roy-pub-vm speedtest-cli]$ python speedtest.py
Retrieving [speedtest.net](http://speedtest.net) configuration...
Testing from Microsoft Corp (168.63.232.200)...
Retrieving [speedtest.net](http://speedtest.net) server list...
Selecting best server based on ping...
Hosted by Singtel (Singapore) [6.25 km]: 3.595 ms
Testing download speed................................................................................
Download: 2028.88 Mbit/s
Testing upload speed................................................................................................
Upload: 1409.85 Mbit/s

多次測(cè)試趴拧,下載大約2Gbit溅漾,上傳大約1.5Gbit。

額外的測(cè)試:(內(nèi)網(wǎng)ip八堡,更多cpu的VM)

For internal IP address test

$ az network nic create -g roy-fpga \
> --name roy-nic \
> --vnet-name roy-fpga-vnet \
> --subnet roy-fpga-subnet \
> --accelerated-networking true
{
  "NewNIC": {
    "additionalProperties": {},
    "dnsSettings": {
      "additionalProperties": {},
      "appliedDnsServers": [],
      "dnsServers": [],
      "internalDnsNameLabel": null,
      "internalDomainNameSuffix": "[50ap2osglnpe5ouvy5u5gwu21d.ix.internal.cloudapp.net](http://50ap2osglnpe5ouvy5u5gwu21d.ix.internal.cloudapp.net)",
      "internalFqdn": null
    },
     "enableAcceleratedNetworking": true,
    "enableIpForwarding": false,
...
 }
}

Create VM with larger size

$ az vm create -g roy-fpga -n roy-internal-vm --image OpenLogic:CentOS:7.4:latest --size Standard_D8s_v3 --nics roy-nic --generate-ssh-keys
{
  "fqdns": "",
  "id": "/subscriptions/xxx/resourceGroups/roy-fpga/providers/[Microsoft.Compute/virtualMachines/roy-internal-vm](http://Microsoft.Compute/virtualMachines/roy-internal-vm)",
  "location": "southeastasia",
  "macAddress": "00-0D-3A-A0-2A-C3",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.5",
  "publicIpAddress": "",
  "resourceGroup": "roy-fpga",
  "zones": ""
}

測(cè)速

From vm

[royzeng@roy-internal-vm speedtest-cli]$ python speedtest.py
Retrieving [speedtest.net](http://speedtest.net) configuration...
Testing from Microsoft Corporation (13.67.45.166)...
Retrieving [speedtest.net](http://speedtest.net) server list...
Selecting best server based on ping...
Hosted by MyRepublic (Singapore) [6.25 km]: 3.007 ms
Testing download speed................................................................................
Download: 2120.53 Mbit/s
Testing upload speed................................................................................................
Upload: 1371.83 Mbit/s

多次測(cè)試樟凄,多個(gè)cpu,在當(dāng)前無負(fù)載的情況下兄渺,網(wǎng)速?zèng)]有提高缝龄。

普通vm 測(cè)試:

$ az vm create -g roy-fpga -n roy-new --image OpenLogic:CentOS:7.4:latest --size Standard_D2s_v3 --generate-ssh-keys
{
  "fqdns": "",
  "id": "/subscriptions/xxx/resourceGroups/roy-fpga/providers/[Microsoft.Compute/virtualMachines/roy-new](http://Microsoft.Compute/virtualMachines/roy-new)",
  "location": "southeastasia",
  "macAddress": "00-0D-3A-A3-E5-66",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.6",
  "publicIpAddress": "168.63.238.227",
  "resourceGroup": "roy-fpga",
  "zones": ""
}

檢查網(wǎng)絡(luò)情況

[royzeng@roy-new speedtest-cli]$ lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) (rev 03)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 01)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 02)
00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA

沒有:Mellanox

網(wǎng)絡(luò)測(cè)速

[royzeng@roy-new speedtest-cli]$ python speedtest.py
Retrieving [speedtest.net](http://speedtest.net) configuration...
Testing from Microsoft Corp (168.63.238.227)...
Retrieving [speedtest.net](http://speedtest.net) server list...
Selecting best server based on ping...
Hosted by Viewqwest Pte Ltd (Singapore) [6.25 km]: 3.064 ms
Testing download speed................................................................................
Download: 1919.65 Mbit/s
Testing upload speed................................................................................................
Upload: 168.21 Mbit/s

下載速度差不多,上傳速度差異明顯

提升現(xiàn)有vm網(wǎng)速

需要停機(jī)挂谍,再升級(jí)nic

VM deallocate
$ az vm deallocate -g roy-fpga -n roy-new
{
  "additionalProperties": {},
  "endTime": "2018-10-29T07:30:44.241096+00:00",
  "error": null,
  "name": "3c5aaac0-751c-4e5a-8acb-b27a09abf14d",
  "startTime": "2018-10-29T07:30:13.537983+00:00",
  "status": "Succeeded"
}
原來的vm size 不能提升網(wǎng)速叔壤,需要resize

(原來vm 的 size 用了超線程,但只有2個(gè)vCPU口叙,加速網(wǎng)絡(luò)需要4個(gè)vCPU)

$ az vm resize -g roy-fpga -n roy-new --size Standard_D4s_v3
{
  "additionalProperties": {},
  "availabilitySet": null,
  "diagnosticsProfile": null,
  "hardwareProfile": {
    "additionalProperties": {},
    "vmSize": "Standard_D4s_v3"
  },
....
}
然后提升網(wǎng)卡
$ az network nic update \
-n roy-newVMNic \
-g roy-fpga \
--accelerated-networking true
{
  "additionalProperties": {},
  "dnsSettings": {
    "additionalProperties": {},
    "appliedDnsServers": [],
    "dnsServers": [],
    "internalDnsNameLabel": null,
    "internalDomainNameSuffix": "[50ap2osglnpe5ouvy5u5gwu21d.ix.internal.cloudapp.net](http://50ap2osglnpe5ouvy5u5gwu21d.ix.internal.cloudapp.net)",
    "internalFqdn": null
  },
  "enableAcceleratedNetworking": true,
  "enableIpForwarding": false,
  "etag": "W/\"b297e515-7047-4056-ae6c-f10ef0103c50\"",
....
}

啟動(dòng)vm
$ az vm start -g roy-fpga -n roy-new
{
  "additionalProperties": {},
  "endTime": "2018-10-29T07:39:44.303596+00:00",
  "error": null,
  "name": "86c0623f-9136-42ca-b2ba-c28d6a9e1619",
  "startTime": "2018-10-29T07:39:24.944233+00:00",
  "status": "Succeeded"
}
登陸vm 檢查
[royzeng@roy-new ~]$ lspci
0000:00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) (rev 03)
0000:00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 01)
0000:00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
0000:00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 02)
0000:00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA
0001:00:02.0 Ethernet controller: Mellanox Technologies MT27500/MT27520 Family [ConnectX-3/ConnectX-3 Pro Virtual Function]

多了: Ethernet controller: Mellanox

測(cè)速:
[royzeng@roy-new speedtest-cli]$ python speedtest.py
Retrieving [speedtest.net](http://speedtest.net) configuration...
Testing from Microsoft Corporation (13.67.40.11)...
Retrieving [speedtest.net](http://speedtest.net) server list...
Selecting best server based on ping...
Hosted by MyRepublic (Singapore) [6.25 km]: 2.047 ms
Testing download speed................................................................................
Download: 1703.39 Mbit/s
Testing upload speed................................................................................................
Upload: 1211.59 Mbit/s

上傳速度從150M到1.2G炼绘,提升了8倍;下載速度妄田,在輕載情況下相差不明顯俺亮。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末驮捍,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子脚曾,更是在濱河造成了極大的恐慌东且,老刑警劉巖,帶你破解...
    沈念sama閱讀 221,695評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件本讥,死亡現(xiàn)場(chǎng)離奇詭異珊泳,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)拷沸,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,569評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門色查,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人撞芍,你說我怎么就攤上這事秧了。” “怎么了序无?”我有些...
    開封第一講書人閱讀 168,130評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵示惊,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我愉镰,道長(zhǎng),這世上最難降的妖魔是什么钧汹? 我笑而不...
    開封第一講書人閱讀 59,648評(píng)論 1 297
  • 正文 為了忘掉前任丈探,我火速辦了婚禮,結(jié)果婚禮上拔莱,老公的妹妹穿的比我還像新娘碗降。我一直安慰自己,他們只是感情好塘秦,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,655評(píng)論 6 397
  • 文/花漫 我一把揭開白布讼渊。 她就那樣靜靜地躺著,像睡著了一般尊剔。 火紅的嫁衣襯著肌膚如雪爪幻。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 52,268評(píng)論 1 309
  • 那天须误,我揣著相機(jī)與錄音挨稿,去河邊找鬼。 笑死京痢,一個(gè)胖子當(dāng)著我的面吹牛奶甘,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播祭椰,決...
    沈念sama閱讀 40,835評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼臭家,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼疲陕!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起钉赁,我...
    開封第一講書人閱讀 39,740評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤蹄殃,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后橄霉,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體窃爷,經(jīng)...
    沈念sama閱讀 46,286評(píng)論 1 318
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,375評(píng)論 3 340
  • 正文 我和宋清朗相戀三年姓蜂,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了按厘。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,505評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡钱慢,死狀恐怖逮京,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情束莫,我是刑警寧澤懒棉,帶...
    沈念sama閱讀 36,185評(píng)論 5 350
  • 正文 年R本政府宣布,位于F島的核電站览绿,受9級(jí)特大地震影響策严,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜饿敲,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,873評(píng)論 3 333
  • 文/蒙蒙 一妻导、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧怀各,春花似錦倔韭、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,357評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至硕蛹,卻和暖如春醇疼,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背妓美。 一陣腳步聲響...
    開封第一講書人閱讀 33,466評(píng)論 1 272
  • 我被黑心中介騙來泰國(guó)打工僵腺, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人壶栋。 一個(gè)月前我還...
    沈念sama閱讀 48,921評(píng)論 3 376
  • 正文 我出身青樓辰如,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親贵试。 傳聞我的和親對(duì)象是個(gè)殘疾皇子琉兜,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,515評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容