DaaS / Products / Deploy optimized ECS with tuned networking

Deploy optimized ECS with tuned networking

A developer provisions an Alibaba Cloud Linux ECS instance, configures its networking (ENI, security groups, public IP), and then applies network performance tuning (TCP TIME-WAIT reduction, SMC acceleration, XPS) to prepare it for a high-throughput production workload.

Products involved

Scenario

This workflow is required when deploying latency-sensitive, high-throughput microservices or data-processing pipelines on Alibaba Cloud. Developers combine ECS infrastructure provisioning with Alibaba Cloud Linux (Alinux) kernel-level network tuning to maximize packet throughput, minimize TCP connection overhead, and leverage hardware-accelerated inter-process communication for production workloads.

Integration steps

  1. Provision Alinux ECS Instance: Launch an instance using the Alibaba Cloud CLI.
  2. aliyun ecs RunInstances --ImageId aliyun_3_x64_20G_alibase_*.vhd --InstanceType ecs.g7.xlarge --VpcId vpc-xxx --VSwitchId vsw-xxx --SecurityGroupId sg-xxx

  3. Attach Secondary ENI & Configure Security Group: Bind a dedicated NIC for workload traffic and open high-port ranges.
  4. aliyun ecs AttachNetworkInterface --InstanceId i-xxx --NetworkInterfaceId eni-xxx aliyun ecs AuthorizeSecurityGroup --SecurityGroupId sg-xxx --IpProtocol tcp --PortRange 8000/9000

  5. Assign Elastic IP (EIP): Allocate and bind a public IP for external ingress.
  6. aliyun vpc AllocateEipAddress --Bandwidth 100 aliyun vpc AssociateEipAddress --EipId eip-xxx --InstanceId i-xxx

  7. Exclude Secondary NIC from NetworkManager: Prevent OS-level routing conflicts by creating /etc/NetworkManager/conf.d/99-unmanaged-eni.conf:
  8. [device-unmanaged]\nmatch-device=interface-name:eth1 systemctl restart NetworkManager

  9. Reduce TCP TIME-WAIT: Tune kernel parameters in /etc/sysctl.conf:
  10. net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_max_tw_buckets = 10000 Apply: sysctl -p

  11. Enable SMC Acceleration: Load the Shared Memory Communication module for intra-VPC traffic:
  12. modprobe smc echo "smc" >> /etc/modules-load.d/smc.conf

  13. Configure XPS (Transmit Packet Steering): Bind TX queues to specific vCPUs on the primary NIC:
  14. echo f > /sys/class/net/eth0/queues/tx-0/xps_cpus echo f > /sys/class/net/eth0/queues/tx-1/xps_cpus

  15. Persist & Verify: Add sysctl and XPS bindings to a systemd startup service. Validate with ss -s and ethtool -S eth0.

Architecture

The ECS control plane manages the virtualized network boundary: VPC routing, ENI attachment, Security Group filtering, and EIP NAT translation. Inbound traffic traverses the EIP → Security Group → ENI pipeline. Alinux takes over at the guest OS layer, where the tuned network stack (TCP parameters, SMC kernel module, XPS CPU affinity) processes packets directly in kernel space, bypassing standard scheduler bottlenecks before delivering them to the application socket.

Prerequisites

Common pitfalls

Typical questions