

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 ENA Express 提高 EC2 執行個體之間的網路效能
<a name="ena-express"></a>

ENA Express 採用可擴展可靠資料包 AWS (SRD) 技術。SRD 是一種高效能的網路傳輸通訊協定，其使用動態路由來增加輸送量並將網路流量尾延遲降至最低。使用 ENA Express，您可以在相同可用區域中的兩個 EC2 執行個體之間進行通訊。

**ENA Express 的優勢**
+ 將單一流程在可用區域中可使用的最高頻寬從 5Gbps 增加到最高 25Gbps，最高可達彙總執行個體限制。
+ 減少 EC2 執行個體之間網路流量的尾延遲，特別是在高網路負載期間。
+ 偵測並避免擁塞的網路路徑。
+ 直接在網路層中處理某些任務，例如接收端的封包重新排序，以及大多數需要的重新傳輸。這會釋放應用程式層進行其他工作。

**注意**  
如果應用程式每秒傳送或接收大量封包，而且大部分時間需要最佳化延遲，尤其是在網路上沒有擁塞的期間，則 [增強型網路](enhanced-networking.md) 可能更適合您的網路。
ENA Express 流量無法在本機區域中傳送。

在執行個體上為網路介面附件啟用 ENA Express 之後，傳送執行個體會啟動與接收執行個體的通訊，而 SRD 會偵測 ENA Express 是否同時在傳送執行個體和接收執行個體上運作。如果 ENA Express 正在運作，則通訊可以使用 SRD 傳輸。如果 ENA Express 尚未運作，則通訊會回復為標準 ENA 傳輸。

在網路流量較輕的期間，當封包使用 ENA Express 時，您可能會注意到封包延遲會略有增加 (數十微秒)。在這段時間內，優先考慮特定網路效能特性的應用程式可以從 ENA Express 中受益，如下所示：
+ 程序可以從相同可用區域內最高單一流量頻寬從 5Gbps 增加到最高 25Gbps 中獲益，最高可達彙總執行個體限制。例如，如果特定執行個體類型最高支援 12.5 Gbps，則單一流量頻寬也會限制為 12.5 Gbps。
+ 在網路擁塞期間，執行時間較長的程序會減少尾延遲。
+ 程序可以從更順暢且更標準的網路回應時間分佈中獲益。

**Topics**
+ [ENA Express 的工作原理](#ena-express-how-it-works)
+ [ENA Express 支援的執行個體類型](#ena-express-supported-instance-types)
+ [使用 Linux 執行個體的先決條件](#ena-express-prereq-linux)
+ [調校 Linux 執行個體上 ENA Express 設定的效能](#ena-express-tune)
+ [檢閱 EC2 執行個體的 ENA Express 設定](ena-express-list-view.md)
+ [設定 EC2 執行個體的 ENA Express 設定](ena-express-configure.md)

## ENA Express 的工作原理
<a name="ena-express-how-it-works"></a>

ENA Express 採用可擴展可靠資料包 AWS (SRD) 技術。它會將每個網路流程的封包分配到不同的 AWS 網路路徑，並在偵測到擁塞跡象時動態調整分佈。它還管理接收端的封包重新排序。

若要確保 ENA Express 可以按預期管理網路流量，傳送和接收執行個體及其之間的通訊必須符合下列所有要求：
+ 支援傳送和接收執行個體類型。如需詳細資訊，請參閱 [ENA Express 支援的執行個體類型](#ena-express-supported-instance-types) 資料表。
+ 傳送和接收執行個體都必須設定 ENA Express。如果組態有任何差異，您可能會遇到流量預設為標準 ENA 傳輸的情況。下列情境說明會發生的情況。

  **情況：組態的差異**    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/AWSEC2/latest/UserGuide/ena-express.html)

  在這種情況下，兩個執行個體之間的 TCP 流量可以使用 ENA Express，因為這兩個執行個體皆已將其啟用。但是，由於其中一個執行個體並未將 ENA Express 用於 UDP 流量，因此這兩個執行個體透過 UDP 之間的通訊會使用標準 ENA 傳輸。
+ 傳送和接收執行個體必須在相同的可用區域中執行。
+ 執行個體之間的網路路徑不得包含中介軟體方塊。ENA Express 目前不支援中介軟體。
+ (僅 Linux 執行個體) 若要充分利用全部頻寬潛力，請使用 2.2.9 或更新版本的驅動程式。
+ (僅 Linux 執行個體) 若要產生指標，請使用 2.8 或更新版本的驅動程式。

如果未滿足任意要求，執行個體會使用標準 TCP/UDP 通訊協定但不帶 SRD 進行通訊。

若要確保您的執行個體網路驅動程式設定為最佳效能，請參閱適用於 ENA 驅動程式的建議最佳實務。這些最佳實務也適用於 ENA Express。如需詳細資訊，請參閱 GitHub 網站上的 [ENA Linux 驅動程式最佳實務與效能最佳化指南](https://github.com/amzn/amzn-drivers/blob/master/kernel/linux/ena/ENA_Linux_Best_Practices.rst)。

**注意**  
Amazon EC2 是指執行個體與以*附件*形式連接到執行個體的網路介面之間的關係。ENA Express 設定會套用至附件。如果網路介面從執行個體中斷連接，則附件將不再存在，而套用至該執行個體的 ENA Express 設定將不再有效。執行個體終止時也是如此，即使網路介面仍然存在。

在傳送執行個體和接收執行個體上啟用網路介面附件的 ENA Express 之後，您可以使用 ENA Express 指標來協助確保您的執行個體充分利用 SRD 技術提供的效能改進。如需 ENA Express 指標的詳細資訊，請參閱 [ENA Express 的指標](monitoring-network-performance-ena.md#network-performance-metrics-ena-express)。

## ENA Express 支援的執行個體類型
<a name="ena-express-supported-instance-types"></a>

下列執行個體類型支援 ENA Express。

------
#### [ General purpose ]


| 執行個體類型 | Architecture | 
| --- | --- | 
| m6a.12xlarge | x86\$164 | 
| m6a.16xlarge | x86\$164 | 
| m6a.24xlarge | x86\$164 | 
| m6a.32xlarge | x86\$164 | 
| m6a.48xlarge | x86\$164 | 
| m6a.metal | x86\$164 | 
| m6i.8xlarge | x86\$164 | 
| m6i.12xlarge | x86\$164 | 
| m6i.16xlarge | x86\$164 | 
| m6i.24xlarge | x86\$164 | 
| m6i.32xlarge | x86\$164 | 
| m6i.metal | x86\$164 | 
| m6id.8xlarge | x86\$164 | 
| m6id.12xlarge | x86\$164 | 
| m6id.16xlarge | x86\$164 | 
| m6id.24xlarge | x86\$164 | 
| m6id.32xlarge | x86\$164 | 
| m6id.metal | x86\$164 | 
| m6idn.8xlarge | x86\$164 | 
| m6idn.12xlarge | x86\$164 | 
| m6idn.16xlarge | x86\$164 | 
| m6idn.24xlarge | x86\$164 | 
| m6idn.32xlarge | x86\$164 | 
| m6idn.metal | x86\$164 | 
| m6in.8xlarge | x86\$164 | 
| m6in.12xlarge | x86\$164 | 
| m6in.16xlarge | x86\$164 | 
| m6in.24xlarge | x86\$164 | 
| m6in.32xlarge | x86\$164 | 
| m6in.metal | x86\$164 | 
| m7a.12xlarge | x86\$164 | 
| m7a.16xlarge | x86\$164 | 
| m7a.24xlarge | x86\$164 | 
| m7a.32xlarge | x86\$164 | 
| m7a.48xlarge | x86\$164 | 
| m7a.metal-48xl | x86\$164 | 
| m7g.12xlarge | arm64 | 
| m7g.16xlarge | arm64 | 
| m7g.metal | arm64 | 
| m7gd.12xlarge | arm64 | 
| m7gd.16xlarge | arm64 | 
| m7gd.metal | arm64 | 
| m7i.12xlarge | x86\$164 | 
| m7i.16xlarge | x86\$164 | 
| m7i.24xlarge | x86\$164 | 
| m7i.48xlarge | x86\$164 | 
| m7i.metal-24xl | x86\$164 | 
| m7i.metal-48xl | x86\$164 | 
| m8a.16xlarge | x86\$164 | 
| m8a.24xlarge | x86\$164 | 
| m8a.48xlarge | x86\$164 | 
| m8a.metal-24xl | x86\$164 | 
| m8a.metal-48xl | x86\$164 | 
| m8azn.12xlarge | x86\$164 | 
| m8azn.24xlarge | x86\$164 | 
| m8azn.metal-12xl | x86\$164 | 
| m8azn.metal-24xl | x86\$164 | 
| m8g.12xlarge | arm64 | 
| m8g.16xlarge | arm64 | 
| m8g.24xlarge | arm64 | 
| m8g.48xlarge | arm64 | 
| m8g.metal-24xl | arm64 | 
| m8g.metal-48xl | arm64 | 
| m8gb.8xlarge | arm64 | 
| m8gb.12xlarge | arm64 | 
| m8gb.16xlarge | arm64 | 
| m8gb.24xlarge | arm64 | 
| m8gb.48xlarge | arm64 | 
| m8gb.metal-24xl | arm64 | 
| m8gb.metal-48xl | arm64 | 
| m8gd.12xlarge | arm64 | 
| m8gd.16xlarge | arm64 | 
| m8gd.24xlarge | arm64 | 
| m8gd.48xlarge | arm64 | 
| m8gd.metal-24xl | arm64 | 
| m8gd.metal-48xl | arm64 | 
| m8gn.8xlarge | arm64 | 
| m8gn.12xlarge | arm64 | 
| m8gn.16xlarge | arm64 | 
| m8gn.24xlarge | arm64 | 
| m8gn.48xlarge | arm64 | 
| m8gn.metal-24xl | arm64 | 
| m8gn.metal-48xl | arm64 | 
| m8i.24xlarge | x86\$164 | 
| m8i.32xlarge | x86\$164 | 
| m8i.48xlarge | x86\$164 | 
| m8i.96xlarge | x86\$164 | 
| m8i.metal-48xl | x86\$164 | 
| m8i.metal-96xl | x86\$164 | 
| m8id.24xlarge | x86\$164 | 
| m8id.32xlarge | x86\$164 | 
| m8id.48xlarge | x86\$164 | 
| m8id.96xlarge | x86\$164 | 
| m8id.metal-48xl | x86\$164 | 
| m8id.metal-96xl | x86\$164 | 

------
#### [ Compute optimized ]


| 執行個體類型 | Architecture | 
| --- | --- | 
| c6a.12xlarge | x86\$164 | 
| c6a.16xlarge | x86\$164 | 
| c6a.24xlarge | x86\$164 | 
| c6a.32xlarge | x86\$164 | 
| c6a.48xlarge | x86\$164 | 
| c6a.metal | x86\$164 | 
| c6gn.4xlarge | arm64 | 
| c6gn.8xlarge | arm64 | 
| c6gn.12xlarge | arm64 | 
| c6gn.16xlarge | arm64 | 
| c6i.8xlarge | x86\$164 | 
| c6i.12xlarge | x86\$164 | 
| c6i.16xlarge | x86\$164 | 
| c6i.24xlarge | x86\$164 | 
| c6i.32xlarge | x86\$164 | 
| c6i.metal | x86\$164 | 
| c6id.8xlarge | x86\$164 | 
| c6id.12xlarge | x86\$164 | 
| c6id.16xlarge | x86\$164 | 
| c6id.24xlarge | x86\$164 | 
| c6id.32xlarge | x86\$164 | 
| c6id.metal | x86\$164 | 
| c6in.8xlarge | x86\$164 | 
| c6in.12xlarge | x86\$164 | 
| c6in.16xlarge | x86\$164 | 
| c6in.24xlarge | x86\$164 | 
| c6in.32xlarge | x86\$164 | 
| c6in.metal | x86\$164 | 
| c7a.12xlarge | x86\$164 | 
| c7a.16xlarge | x86\$164 | 
| c7a.24xlarge | x86\$164 | 
| c7a.32xlarge | x86\$164 | 
| c7a.48xlarge | x86\$164 | 
| c7a.metal-48xl | x86\$164 | 
| c7g.12xlarge | arm64 | 
| c7g.16xlarge | arm64 | 
| c7g.metal | arm64 | 
| c7gd.12xlarge | arm64 | 
| c7gd.16xlarge | arm64 | 
| c7gd.metal | arm64 | 
| c7gn.4xlarge | arm64 | 
| c7gn.8xlarge | arm64 | 
| c7gn.12xlarge | arm64 | 
| c7gn.16xlarge | arm64 | 
| c7gn.metal | arm64 | 
| c7i.12xlarge | x86\$164 | 
| c7i.16xlarge | x86\$164 | 
| c7i.24xlarge | x86\$164 | 
| c7i.48xlarge | x86\$164 | 
| c7i.metal-24xl | x86\$164 | 
| c7i.metal-48xl | x86\$164 | 
| c8a.16xlarge | x86\$164 | 
| c8a.24xlarge | x86\$164 | 
| c8a.48xlarge | x86\$164 | 
| c8a.metal-24xl | x86\$164 | 
| c8a.metal-48xl | x86\$164 | 
| c8g.12xlarge | arm64 | 
| c8g.16xlarge | arm64 | 
| c8g.24xlarge | arm64 | 
| c8g.48xlarge | arm64 | 
| c8g.metal-24xl | arm64 | 
| c8g.metal-48xl | arm64 | 
| c8gb.8xlarge | arm64 | 
| c8gb.12xlarge | arm64 | 
| c8gb.16xlarge | arm64 | 
| c8gb.24xlarge | arm64 | 
| c8gb.48xlarge | arm64 | 
| c8gb.metal-24xl | arm64 | 
| c8gb.metal-48xl | arm64 | 
| c8gd.12xlarge | arm64 | 
| c8gd.16xlarge | arm64 | 
| c8gd.24xlarge | arm64 | 
| c8gd.48xlarge | arm64 | 
| c8gd.metal-24xl | arm64 | 
| c8gd.metal-48xl | arm64 | 
| c8gn.8xlarge | arm64 | 
| c8gn.12xlarge | arm64 | 
| c8gn.16xlarge | arm64 | 
| c8gn.24xlarge | arm64 | 
| c8gn.48xlarge | arm64 | 
| c8gn.metal-24xl | arm64 | 
| c8gn.metal-48xl | arm64 | 
| c8i.24xlarge | x86\$164 | 
| c8i.32xlarge | x86\$164 | 
| c8i.48xlarge | x86\$164 | 
| c8i.96xlarge | x86\$164 | 
| c8i.metal-48xl | x86\$164 | 
| c8i.metal-96xl | x86\$164 | 
| c8id.24xlarge | x86\$164 | 
| c8id.32xlarge | x86\$164 | 
| c8id.48xlarge | x86\$164 | 
| c8id.96xlarge | x86\$164 | 
| c8id.metal-48xl | x86\$164 | 
| c8id.metal-96xl | x86\$164 | 

------
#### [ Memory optimized ]


| 執行個體類型 | Architecture | 
| --- | --- | 
| r6a.12xlarge | x86\$164 | 
| r6a.16xlarge | x86\$164 | 
| r6a.24xlarge | x86\$164 | 
| r6a.32xlarge | x86\$164 | 
| r6a.48xlarge | x86\$164 | 
| r6a.metal | x86\$164 | 
| r6i.8xlarge | x86\$164 | 
| r6i.12xlarge | x86\$164 | 
| r6i.16xlarge | x86\$164 | 
| r6i.24xlarge | x86\$164 | 
| r6i.32xlarge | x86\$164 | 
| r6i.metal | x86\$164 | 
| r6id.8xlarge | x86\$164 | 
| r6id.12xlarge | x86\$164 | 
| r6id.16xlarge | x86\$164 | 
| r6id.24xlarge | x86\$164 | 
| r6id.32xlarge | x86\$164 | 
| r6id.metal | x86\$164 | 
| r6idn.8xlarge | x86\$164 | 
| r6idn.12xlarge | x86\$164 | 
| r6idn.16xlarge | x86\$164 | 
| r6idn.24xlarge | x86\$164 | 
| r6idn.32xlarge | x86\$164 | 
| r6idn.metal | x86\$164 | 
| r6in.8xlarge | x86\$164 | 
| r6in.12xlarge | x86\$164 | 
| r6in.16xlarge | x86\$164 | 
| r6in.24xlarge | x86\$164 | 
| r6in.32xlarge | x86\$164 | 
| r6in.metal | x86\$164 | 
| r7a.12xlarge | x86\$164 | 
| r7a.16xlarge | x86\$164 | 
| r7a.24xlarge | x86\$164 | 
| r7a.32xlarge | x86\$164 | 
| r7a.48xlarge | x86\$164 | 
| r7a.metal-48xl | x86\$164 | 
| r7g.12xlarge | arm64 | 
| r7g.16xlarge | arm64 | 
| r7g.metal | arm64 | 
| r7gd.12xlarge | arm64 | 
| r7gd.16xlarge | arm64 | 
| r7gd.metal | arm64 | 
| r7i.12xlarge | x86\$164 | 
| r7i.16xlarge | x86\$164 | 
| r7i.24xlarge | x86\$164 | 
| r7i.48xlarge | x86\$164 | 
| r7i.metal-24xl | x86\$164 | 
| r7i.metal-48xl | x86\$164 | 
| r7iz.8xlarge | x86\$164 | 
| r7iz.12xlarge | x86\$164 | 
| r7iz.16xlarge | x86\$164 | 
| r7iz.32xlarge | x86\$164 | 
| r7iz.metal-16xl | x86\$164 | 
| r7iz.metal-32xl | x86\$164 | 
| r8a.16xlarge | x86\$164 | 
| r8a.24xlarge | x86\$164 | 
| r8a.48xlarge | x86\$164 | 
| r8a.metal-24xl | x86\$164 | 
| r8a.metal-48xl | x86\$164 | 
| r8g.12xlarge | arm64 | 
| r8g.16xlarge | arm64 | 
| r8g.24xlarge | arm64 | 
| r8g.48xlarge | arm64 | 
| r8g.metal-24xl | arm64 | 
| r8g.metal-48xl | arm64 | 
| r8gb.8xlarge | arm64 | 
| r8gb.12xlarge | arm64 | 
| r8gb.16xlarge | arm64 | 
| r8gb.24xlarge | arm64 | 
| r8gb.48xlarge | arm64 | 
| r8gb.metal-24xl | arm64 | 
| r8gb.metal-48xl | arm64 | 
| r8gd.12xlarge | arm64 | 
| r8gd.16xlarge | arm64 | 
| r8gd.24xlarge | arm64 | 
| r8gd.48xlarge | arm64 | 
| r8gd.metal-24xl | arm64 | 
| r8gd.metal-48xl | arm64 | 
| r8gn.8xlarge | arm64 | 
| r8gn.12xlarge | arm64 | 
| r8gn.16xlarge | arm64 | 
| r8gn.24xlarge | arm64 | 
| r8gn.48xlarge | arm64 | 
| r8gn.metal-24xl | arm64 | 
| r8gn.metal-48xl | arm64 | 
| r8i.24xlarge | x86\$164 | 
| r8i.32xlarge | x86\$164 | 
| r8i.48xlarge | x86\$164 | 
| r8i.96xlarge | x86\$164 | 
| r8i.metal-48xl | x86\$164 | 
| r8i.metal-96xl | x86\$164 | 
| r8id.24xlarge | x86\$164 | 
| r8id.32xlarge | x86\$164 | 
| r8id.48xlarge | x86\$164 | 
| r8id.96xlarge | x86\$164 | 
| r8id.metal-48xl | x86\$164 | 
| r8id.metal-96xl | x86\$164 | 
| u7i-6tb.112xlarge | x86\$164 | 
| u7i-8tb.112xlarge | x86\$164 | 
| u7i-12tb.224xlarge | x86\$164 | 
| u7in-16tb.224xlarge | x86\$164 | 
| u7in-24tb.224xlarge | x86\$164 | 
| u7in-32tb.224xlarge | x86\$164 | 
| u7inh-32tb.480xlarge | x86\$164 | 
| x2idn.16xlarge | x86\$164 | 
| x2idn.24xlarge | x86\$164 | 
| x2idn.32xlarge | x86\$164 | 
| x2idn.metal | x86\$164 | 
| x2iedn.8xlarge | x86\$164 | 
| x2iedn.16xlarge | x86\$164 | 
| x2iedn.24xlarge | x86\$164 | 
| x2iedn.32xlarge | x86\$164 | 
| x2iedn.metal | x86\$164 | 
| x8g.12xlarge | arm64 | 
| x8g.16xlarge | arm64 | 
| x8g.24xlarge | arm64 | 
| x8g.48xlarge | arm64 | 
| x8g.metal-24xl | arm64 | 
| x8g.metal-48xl | arm64 | 
| x8aedz.24xlarge | x86\$164 | 
| x8aedz.metal-24xl | x86\$164 | 
| x8i.24xlarge | x86\$164 | 
| x8i.32xlarge | x86\$164 | 
| x8i.48xlarge | x86\$164 | 
| x8i.64xlarge | x86\$164 | 
| x8i.96xlarge | x86\$164 | 
| x8i.metal-48xl | x86\$164 | 
| x8i.metal-96xl | x86\$164 | 

------
#### [ Accelerated computing ]


| 執行個體類型 | Architecture | 
| --- | --- | 
| g6.48xlarge | x86\$164 | 
| g6e.12xlarge | x86\$164 | 
| g6e.24xlarge | x86\$164 | 
| g6e.48xlarge | x86\$164 | 
| g7e.12xlarge | x86\$164 | 
| g7e.24xlarge | x86\$164 | 
| g7e.48xlarge | x86\$164 | 
| p5.4xlarge | x86\$164 | 
| p5.48xlarge | x86\$164 | 
| p5e.48xlarge | x86\$164 | 
| p5en.48xlarge | x86\$164 | 
| p6-b200.48xlarge | x86\$164 | 
| p6-b300.48xlarge | x86\$164 | 

------
#### [ Storage optimized ]


| 執行個體類型 | Architecture | 
| --- | --- | 
| i4g.4xlarge | arm64 | 
| i4g.8xlarge | arm64 | 
| i4g.16xlarge | arm64 | 
| i4i.8xlarge | x86\$164 | 
| i4i.12xlarge | x86\$164 | 
| i4i.16xlarge | x86\$164 | 
| i4i.24xlarge | x86\$164 | 
| i4i.32xlarge | x86\$164 | 
| i4i.metal | x86\$164 | 
| i7i.12xlarge | x86\$164 | 
| i7i.16xlarge | x86\$164 | 
| i7i.24xlarge | x86\$164 | 
| i7i.48xlarge | x86\$164 | 
| i7i.metal-24xl | x86\$164 | 
| i7i.metal-48xl | x86\$164 | 
| i7ie.12xlarge | x86\$164 | 
| i7ie.18xlarge | x86\$164 | 
| i7ie.24xlarge | x86\$164 | 
| i7ie.48xlarge | x86\$164 | 
| i7ie.metal-24xl | x86\$164 | 
| i7ie.metal-48xl | x86\$164 | 
| i8g.12xlarge | arm64 | 
| i8g.16xlarge | arm64 | 
| i8g.24xlarge | arm64 | 
| i8g.48xlarge | arm64 | 
| i8g.metal-24xl | arm64 | 
| i8g.metal-48xl | arm64 | 
| i8ge.12xlarge | arm64 | 
| i8ge.18xlarge | arm64 | 
| i8ge.24xlarge | arm64 | 
| i8ge.48xlarge | arm64 | 
| i8ge.metal-24xl | arm64 | 
| i8ge.metal-48xl | arm64 | 
| im4gn.4xlarge | arm64 | 
| im4gn.8xlarge | arm64 | 
| im4gn.16xlarge | arm64 | 

------

## 使用 Linux 執行個體的先決條件
<a name="ena-express-prereq-linux"></a>

若要確保 ENA Express 可以順利運作，請為您的執行個體更新下列設定。
+ 如果您的執行個體使用巨型訊框，則請執行下列命令，將最大傳輸單位 (MTU) 設定為 `8900`。

  ```
  [ec2-user ~]$ sudo ip link set dev eth0 mtu 8900
  ```
+ 增加接收器 (Rx) 環的大小，如下所示：

  ```
  [ec2-user ~]$ ethtool -G device rx 8192
  ```
+ 若要最大化 ENA Express 頻寬，請依照下列方式設定 TCP 佇列限制：

  1. 將 TCP 小型佇列限制設定為 1 MB 或更大值。這會讓在通訊端上排入佇列並等待傳輸的資料量增多。

     ```
     sudo sh -c 'echo 1048576 > /proc/sys/net/ipv4/tcp_limit_output_bytes'
     ```

  1. 如果 Linux 發行版本已啟用 eth 裝置上的位元組佇列限制，請將其停用。對裝置佇列來說，這也會讓排入佇列並等待傳輸的資料增多。

     ```
     sudo sh -c 'for txq in /sys/class/net/eth0/queues/tx-*; do echo max > ${txq}/byte_queue_limits/limit_min; done'
     ```
**注意**  
Amazon Linux 發行版本的 ENA 驅動程式預設會停用位元組佇列限制。
+ 若要將 ENA Express TCP 流量延遲降至最低，您可以停用 TCP 自動追蹤功能。這可能會導致封包額外負荷的最小增加：

  ```
  sudo bash -c 'echo 0 > /proc/sys/net/ipv4/tcp_autocorking'
  ```

## 調校 Linux 執行個體上 ENA Express 設定的效能
<a name="ena-express-tune"></a>

若要檢查您的 Linux 執行個體組態是否有最佳的 ENA Express 效能，您可以執行下列可在 Amazon GitHub 儲存庫上使用的指令碼：

[https://github.com/amzn/amzn-ec2-ena-utilities/blob/main/ena-express/check-ena-express-settings.sh](https://github.com/amzn/amzn-ec2-ena-utilities/blob/main/ena-express/check-ena-express-settings.sh)

指令碼會執行一系列測試，並提出建議及必要的組態變更。

# 檢閱 EC2 執行個體的 ENA Express 設定
<a name="ena-express-list-view"></a>

您可以依執行個體或網路介面驗證 ENA Express 設定。要更新 ENA Express 設定，請參閱 [設定 EC2 執行個體的 ENA Express 設定](ena-express-configure.md)。

------
#### [ Console ]

**檢視網路介面的 ENA Express 設定**

1. 前往 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 開啟 Amazon EC2 主控台。

1. 在左側導覽窗格中，選擇 **Network Interfaces** (網路介面)。

1. 選取網路介面以查看該執行個體的詳細資訊。您可以選擇 **Network interface ID** (網路介面 ID) 連結，以開啟詳細資訊頁面；或選取清單左側的核取方塊，以在頁面底部的詳細資訊窗格中檢視詳細資訊。

1. 在**詳細資訊**索引標籤或詳細資訊頁面的**網路介面附件**區段中，檢視 **ENA Express** 和 **ENA Express UDP** 的設定。

**檢視執行個體的 ENA Express 設定**

1. 前往 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 開啟 Amazon EC2 主控台。

1. 在左側導覽窗格中選擇 **(執行個體)**。

1. 選取執行個體以查看該執行個體的詳細資訊。您可以選擇 **Instance ID** (執行個體 ID) 連結，以開啟詳細資訊頁面；或選取清單左側的核取方塊，以在頁面底部的詳細資訊窗格中檢視詳細資訊。

1. 在 **Networking** (聯網) 標籤的 **Network interfaces** (網路介面) 區段中，向右捲動以檢視 **ENA Express** 和 **ENA Express UDP** 的設定。

------
#### [ AWS CLI ]

**取得執行個體的 ENA Express 設定**  
使用 [https://docs.aws.amazon.com/cli/latest/reference/describe-instances.html](https://docs.aws.amazon.com/cli/latest/reference/describe-instances.html) 命令。此命令範例會傳回連接到 `--instance-ids` 參數所指定之每個執行中執行個體，以及其網路介面的 ENA Express 組態清單。

```
aws ec2 describe-instances \
    --instance-ids i-1234567890abcdef0 i-0598c7d356eba48d7 \
    --query 'Reservations[*].Instances[*].[InstanceId, NetworkInterfaces[*].Attachment.EnaSrdSpecification]'
```

以下為範例輸出。

```
[
    [
        [
            "i-1234567890abcdef0",
            [
                {
                    "EnaSrdEnabled": true,
                    "EnaSrdUdpSpecification": {
                        "EnaSrdUdpEnabled": false
                    }
                }
            ]
        ]
    ],
    [
        [
            "i-0598c7d356eba48d7",
            [
            {
                    "EnaSrdEnabled": true,
                    "EnaSrdUdpSpecification": {
                        "EnaSrdUdpEnabled": false
                    }
                }
            ]
        ]
    ]
]
```

**取得網路介面的 ENA Express 設定**  
使用 [https://docs.aws.amazon.com/cli/latest/reference/describe-network-interfaces.html](https://docs.aws.amazon.com/cli/latest/reference/describe-network-interfaces.html) 命令。

```
aws ec2 describe-network-interfaces \
    --network-interface-ids eni-1234567890abcdef0 \
    --query NetworkInterfaces[].[NetworkInterfaceId,Attachment.EnaSrdSpecification]
```

以下為範例輸出。

```
[
    [
        "eni-1234567890abcdef0",
        {
            "EnaSrdEnabled": true,
            "EnaSrdUdpSpecification": {
                "EnaSrdUdpEnabled": false
            }
        }
    ]
]
```

------
#### [ PowerShell ]

**取得網路介面的 ENA Express 設定**  
使用 [https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2NetworkInterface.html](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2NetworkInterface.html) cmdlet。

```
Get-EC2NetworkInterface `
    -NetworkInterfaceId eni-1234567890abcdef0 | `
Select-Object `
    Association, 
    NetworkInterfaceId, 
    OwnerId, 
    @{Name = 'AttachTime'; Expression = { $_.Attachment.AttachTime } },
    @{Name = 'AttachmentId'; Expression = { $_.Attachment.AttachmentId } },
    @{Name = 'DeleteOnTermination'; Expression = { $_.Attachment.DeleteOnTermination } },
    @{Name = 'NetworkCardIndex'; Expression = { $_.Attachment.NetworkCardIndex } },
    @{Name = 'InstanceId'; Expression = { $_.Attachment.InstanceId } },
    @{Name = 'InstanceOwnerId'; Expression = { $_.Attachment.InstanceOwnerId } },
    @{Name = 'Status'; Expression = { $_.Attachment.Status } },
    @{Name = 'EnaSrdEnabled'; Expression = { $_.Attachment.EnaSrdSpecification.EnaSrdEnabled } },
    @{Name = 'EnaSrdUdpEnabled'; Expression = { $_.Attachment.EnaSrdSpecification.EnaSrdUdpSpecification.EnaSrdUdpEnabled } }
```

以下為範例輸出。

```
Association         : 
NetworkInterfaceId  : eni-0d1234e5f6a78901b
OwnerId             : 111122223333
AttachTime          : 6/11/2022 1:13:11 AM
AttachmentId        : eni-attach-0d1234e5f6a78901b
DeleteOnTermination : True
NetworkCardIndex    : 0
InstanceId          : i-1234567890abcdef0
InstanceOwnerId     : 111122223333
Status              : attached
EnaSrdEnabled       : True
EnaSrdUdpEnabled    : False
```

------

# 設定 EC2 執行個體的 ENA Express 設定
<a name="ena-express-configure"></a>

您可以針對支援的 EC2 執行個體類型設定 ENA Express，而無需安裝任何其他軟體。如需詳細資訊，請參閱[ENA Express 支援的執行個體類型](ena-express.md#ena-express-supported-instance-types)。

------
#### [ Console ]

**管理網路介面的 ENA Express**

1. 前往 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 開啟 Amazon EC2 主控台。

1. 在左側導覽窗格中，選擇 **Network Interfaces** (網路介面)。

1. 選取要連接到執行個體的網路介面。您可以選擇 **Network interface ID** (網路介面 ID) 連結，以開啟詳細資訊頁面；或選取清單左側的核取方塊。

1. 從頁面右上角的 **Action** (動作) 功能表中選擇 **Manage ENA Express** (管理 ENA Express)。此操作會開啟 **Manage ENA Express** (管理 ENA Express) 對話方塊，並顯示選取的網路介面 ID 和目前設定。

   如果您選取的網路介面未連接至執行個體，則此動作不會顯示在功能表中。

1. 若要使用 **ENA Express**，請選取**啟用**核取方塊。

1. 啟用 ENA Express 時，您可以設定 UDP 設定。若要使用 **ENA Express UDP**，請選取**啟用**核取方塊。

1. 若要儲存設定，請選擇 **Save** (儲存)。

**管理執行個體的 ENA Express**

1. 前往 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 開啟 Amazon EC2 主控台。

1. 在左側導覽窗格中選擇 **(執行個體)**。

1. 選取您要管理的執行個體。您可以選擇 **Instance ID** (執行個體 ID) 連結，以開啟詳細資訊頁面；或選取清單左側的核取方塊。

1. 選取要為您的執行個體設定的 **Network interface** (網路介面)。

1. 從頁面右上角的 **Action** (動作) 功能表中選擇 **Manage ENA Express** (管理 ENA Express)。

1. 若要為連接至執行個體的網路介面設定 ENA Express，請從 **Network interface** (網路介面) 清單中進行選取。

1. 若要將 **ENA Express** 用於選取的網路介面附件，請選取**啟用**核取方塊。

1. 啟用 ENA Express 時，您可以設定 UDP 設定。若要使用 **ENA Express UDP**，請選取**啟用**核取方塊。

1. 若要儲存設定，請選擇 **Save** (儲存)。

**當您連接網路介面時設定 ENA Express**

1. 前往 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 開啟 Amazon EC2 主控台。

1. 在左側導覽窗格中，選擇 **Network Interfaces** (網路介面)。

1. 選取未連接到執行個體的網路介面 (**Status** (狀態) 為 **Available** (可用)。您可以選擇 **Network interface ID** (網路介面 ID) 連結，以開啟詳細資訊頁面；或選取清單左側的核取方塊。

1. 選取您要連接的 **Instance** (執行個體)。

1. 若要在您將網路介面連接至執行個體後使用 **ENA Express**，請選取**啟用**核取方塊。

1. 啟用 ENA Express 時，您可以設定 UDP 設定。若要使用 **ENA Express UDP**，請選取**啟用**核取方塊。

1. 若要將網路介面連接至執行個體並儲存 ENA Express 設定，請選擇 **Attach** (連接)。

------
#### [ AWS CLI ]

**當您連接網路介面時設定 ENA Express**  
使用 [https://docs.aws.amazon.com/cli/latest/reference/;attach-network-interface.html](https://docs.aws.amazon.com/cli/latest/reference/;attach-network-interface.html) 命令，如下列範例所示。

**範例 1：將 ENA Express 用於 TCP 流量而非 UDP 流量**  
此範例將 `EnaSrdEnabled` 設定為 `true`，並允許 `EnaSrdUdpEnabled` 預設為 `false`。

```
aws ec2 attach-network-interface \
    --network-interface-id eni-1234567890abcdef0 \
    --instance-id i-1234567890abcdef0 \
    --device-index 1 \
    --ena-srd-specification 'EnaSrdEnabled=true'
```

**範例 2：將 ENA Express 用於 TCP 流量和 UDP 流量**  
在此範例中，將 `EnaSrdEnabled` 和 `EnaSrdUdpEnabled` 都設定為 `true`。

```
aws ec2 attach-network-interface \
    --network-interface-id eni-1234567890abcdef0 \
    --instance-id i-1234567890abcdef0 \
    --device-index 1 \
    --ena-srd-specification 'EnaSrdEnabled=true,EnaSrdUdpSpecification={EnaSrdUdpEnabled=true}'
```

**更新網路介面附件的 ENA Express 設定**  
使用 [https://docs.aws.amazon.com/cli/latest/reference/modify-network-interface-attribute.html](https://docs.aws.amazon.com/cli/latest/reference/modify-network-interface-attribute.html) 命令，如下列範例所示。

**範例 1：將 ENA Express 用於 TCP 流量而非 UDP 流量**  
此範例會將 `EnaSrdEnabled` 設定為 `true`，並且允許將 `EnaSrdUdpEnabled` 預設為 `false`，如果之前並未設定。

```
aws ec2 modify-network-interface-attribute \
    --network-interface-id eni-1234567890abcdef0 \
    --ena-srd-specification 'EnaSrdEnabled=true'
```

**範例 2：將 ENA Express 用於 TCP 流量和 UDP 流量**  
在此範例中，將 `EnaSrdEnabled` 和 `EnaSrdUdpEnabled` 都設定為 `true`。

```
aws ec2 modify-network-interface-attribute \
    --network-interface-id eni-1234567890abcdef0 \
    --ena-srd-specification 'EnaSrdEnabled=true,EnaSrdUdpSpecification={EnaSrdUdpEnabled=true}'
```

**範例 3：停止將 ENA Express 用於 UDP 流量**  
此範例會將 `EnaSrdUdpEnabled` 設定為 `false`。

```
aws ec2 modify-network-interface-attribute \
    --network-interface-id eni-1234567890abcdef0 \
    --ena-srd-specification 'EnaSrdUdpSpecification={EnaSrdUdpEnabled=false}'
```

------
#### [ PowerShell ]

**當您連接網路介面時設定 ENA Express**  
使用 [https://docs.aws.amazon.com/powershell/latest/reference/items/Add-EC2NetworkInterface.html](https://docs.aws.amazon.com/powershell/latest/reference/items/Add-EC2NetworkInterface.html) cmdlet，如以下範例所示。

**範例 1：將 ENA Express 用於 TCP 流量而非 UDP 流量**  
此範例將 `EnaSrdEnabled` 設定為 `true`，並允許 `EnaSrdUdpEnabled` 預設為 `false`。

```
Add-EC2NetworkInterface `
    -NetworkInterfaceId eni-1234567890abcdef0 `
    -InstanceId i-1234567890abcdef0 `
    -DeviceIndex 1 `
    -EnaSrdSpecification_EnaSrdEnabled $true
```

**範例 2：將 ENA Express 用於 TCP 流量和 UDP 流量**  
在此範例中，將 `EnaSrdEnabled` 和 `EnaSrdUdpEnabled` 都設定為 `true`。

```
Add-EC2NetworkInterface `
    -NetworkInterfaceId eni-1234567890abcdef0 `
    -InstanceId i-1234567890abcdef0 `
    -DeviceIndex 1 `
    -EnaSrdSpecification_EnaSrdEnabled $true `
    -EnaSrdUdpSpecification_EnaSrdUdpEnabled $true
```

**設定網路介面附件的 ENA Express 設定**  
使用 [https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2NetworkInterfaceAttribute.html](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2NetworkInterfaceAttribute.html) cmdlet，如以下範例所示。

**範例 1：將 ENA Express 用於 TCP 流量而非 UDP 流量**  
此範例會將 `EnaSrdEnabled` 設定為 `true`，並且允許將 `EnaSrdUdpEnabled` 預設為 `false`，如果之前並未設定。

```
Edit-EC2NetworkInterfaceAttribute `
    -NetworkInterfaceId eni-1234567890abcdef0 `
    -EnaSrdSpecification_EnaSrdEnabled $true ; 
Get-EC2NetworkInterface -NetworkInterfaceId eni-0123f4567890a1b23 | `
Select-Object `
    NetworkInterfaceId, 
    @{Name = 'EnaSrdEnabled'; Expression = { $_.Attachment.EnaSrdSpecification.EnaSrdEnabled }}, 
    @{Name = 'EnaSrdUdpEnabled'; Expression = { $_.Attachment.EnaSrdSpecification.EnaSrdUdpSpecification.EnaSrdUdpEnabled }} | `
Format-List
```

**範例 2：將 ENA Express 用於 TCP 流量和 UDP 流量**  
在此範例中，將 `EnaSrdEnabled` 和 `EnaSrdUdpEnabled` 都設定為 `true`。

```
Edit-EC2NetworkInterfaceAttribute `
    -NetworkInterfaceId eni-1234567890abcdef0 `
    -EnaSrdSpecification_EnaSrdEnabled $true `
    -EnaSrdSpecification_EnaSrdUdpSpecification_EnaSrdUdpEnabled $true ;
Get-EC2NetworkInterface -NetworkInterfaceId eni-1234567890abcdef0 | `
Select-Object `
    NetworkInterfaceId, 
    @{Name = 'EnaSrdEnabled'; Expression = { $_.Attachment.EnaSrdSpecification.EnaSrdEnabled }}, 
    @{Name = 'EnaSrdUdpEnabled'; Expression = { $_.Attachment.EnaSrdSpecification.EnaSrdUdpSpecification.EnaSrdUdpEnabled }} | `
Format-List
```

**範例 3：停止將 ENA Express 用於 UDP 流量**  
此範例會將 `EnaSrdUdpEnabled` 設定為 `false`。

```
Edit-EC2NetworkInterfaceAttribute `
    -NetworkInterfaceId eni-0123f4567890a1b23 `
    -EnaSrdSpecification_EnaSrdUdpSpecification_EnaSrdUdpEnabled $false ; 
Get-EC2NetworkInterface -NetworkInterfaceId eni-0123f4567890a1b23 | `
Select-Object `
    NetworkInterfaceId, 
    @{Name = 'EnaSrdEnabled'; Expression = { $_.Attachment.EnaSrdSpecification.EnaSrdEnabled }}, 
    @{Name = 'EnaSrdUdpEnabled'; Expression = { $_.Attachment.EnaSrdSpecification.EnaSrdUdpSpecification.EnaSrdUdpEnabled }} | `
Format-List
```

------

## 在啟動時設定 ENA Express
<a name="ena-express-configure-on-launch"></a>

啟動執行個體時，您可以使用下列其中一種方法來直接設定 ENA Express。指定的連結會參考這些方法 AWS 管理主控台 的說明。
+ **啟動執行個體精靈** – 您可以使用啟動執行個體精靈在啟動時設定 ENA Express。如需詳細資訊，請參閱啟動執行個體精靈的 [網路設定](ec2-instance-launch-parameters.md#liw-network-settings) 中的「進階網路組態」****。
+ **啟動範本** – 當您使用啟動範本時，可以在啟動時設定 ENA Express。如需詳細資訊，請參閱 [建立 Amazon EC2 啟動範本](create-launch-template.md) 頁面，然後展開「網路設定」****區段，並檢閱「進階網路組態」****。