阿里云容器服务网络性能测试

本文涉及的产品
容器镜像服务 ACR,镜像仓库100个 不限时长
简介: 从时延和吞吐这两个维度测试了四种不同的服务之间相互访问的模式的网络性能并给出了测试结论。最后提出了几个应用方面的问题。

背景

我们正在将测试环境逐步从mesos框架迁移到阿里云的容器服务,在此过程中测试了四种不同的服务之间相互访问的模式的网络性能。本文阐述了该性能测试的方法,数据和结论。

测试目标

服务容器之间的交互存在四种不同的访问方式:

docker link

docker提供的link方式,可以在一个容器中访问另一个容器。 测试host为app-link。

hostname

在编排服务时,为每一个服务指定一个hostname,在其他服务中可以使用hostname访问对应的服务。测试host为app。

服务发现

容器服务基于HAProxy实现的一套服务间HTTP访问和负载均衡的机制。测试host为app.local。

SLB

传统的负载均衡服务,有HTTP和TCP两种监听模式。测试中HTTP SLB host为192.168.1.10,TCP SLB host为192.168.1.40。

分别通过这四种网络访问目标机器上的http服务接口/ok并测试延迟(latency)和吞吐量(throughput)。

测试工具

  • httping:测试延迟
  • ab(apache benchmarking tool):测试吞吐量

ubuntu 下安装:

  apt-get install httping
  apt-get install apache2-utils

延迟测试:

  1. link:
  httping -c100 -i 0.01 -g 'http://app-link/ok'
  ...
  connected to 172.18.1.3:80 (121 bytes), seq=96 time=0.45 ms
  connected to 172.18.1.3:80 (121 bytes), seq=97 time=0.46 ms
  connected to 172.18.1.3:80 (121 bytes), seq=98 time=0.42 ms
  connected to 172.18.1.3:80 (121 bytes), seq=99 time=1.63 ms
  --- http://app-link/ok ping statistics ---
  100 connects, 100 ok, 0.00% failed, time 1050ms
  round-trip min/avg/max = 0.4/0.5/1.6 ms
  1. hostname
  httping -c100 -i 0.01 -g 'http://app/ok'
  ...
  connected to 172.18.1.3:80 (121 bytes), seq=96 time=10.80 ms
  connected to 172.18.1.3:80 (121 bytes), seq=97 time=0.43 ms
  connected to 172.18.1.3:80 (121 bytes), seq=98 time=0.44 ms
  connected to 172.18.1.3:80 (121 bytes), seq=99 time=0.46 ms
  --- http://app/ok ping statistics ---
  100 connects, 100 ok, 0.00% failed, time 1073ms
  round-trip min/avg/max = 0.4/0.7/10.8 ms
  1. 服务发现
  httping -c100 -i 0.01 -g 'http://app.local/ok'
  ...
  connected to 172.18.1.2:80 (219 bytes), seq=96 time=0.69 ms
  connected to 172.18.1.2:80 (219 bytes), seq=97 time=0.67 ms
  connected to 172.18.1.2:80 (219 bytes), seq=98 time=0.74 ms
  connected to 172.18.1.2:80 (219 bytes), seq=99 time=0.65 ms
  --- http://app.local/ok ping statistics ---
  100 connects, 100 ok, 0.00% failed, time 1090ms
  round-trip min/avg/max = 0.6/0.9/6.0 ms
  1. HTTP SLB
  httping -c100 -i 0.01 -g 'http://192.168.1.10/ok'
  ...
  connected to 192.168.1.10:80 (140 bytes), seq=96 time=1.19 ms
  connected to 192.168.1.10:80 (140 bytes), seq=97 time=1.08 ms
  connected to 192.168.1.10:80 (140 bytes), seq=98 time=1.15 ms
  connected to 192.168.1.10:80 (140 bytes), seq=99 time=1.30 ms
  --- http://192.168.1.10/ok ping statistics ---
  100 connects, 100 ok, 0.00% failed, time 1123ms
  round-trip min/avg/max = 1.0/1.2/2.9 ms
  1. TCP SLB
  httping -c100 -i 0.01 -g 'http://192.168.1.40/ok'
  ...
  connected to 192.168.1.40:80 (121 bytes), seq=96 time=1.18 ms
  connected to 192.168.1.40:80 (121 bytes), seq=97 time=1.25 ms
  connected to 192.168.1.40:80 (121 bytes), seq=98 time=1.06 ms
  connected to 192.168.1.40:80 (121 bytes), seq=99 time=1.34 ms
  --- http://192.168.1.40/ok ping statistics ---
  100 connects, 100 ok, 0.00% failed, time 1137ms
  round-trip min/avg/max = 1.0/1.3/2.7 ms

测试结果

测试了100次HEAD请求,平均时延如下表:

访问方式 延时(ms)
docker link 0.5
hostname 0.7
服务发现 0.9
HTTP SLB 1.2
TCP SLB 1.3

吞吐量测试:

  1. link
  ab -lkc 10000 -n 10000 'http://app-link/ok'
  Concurrency Level:      10000
  Time taken for tests:   0.864 seconds
  Complete requests:      10000
  Failed requests:        0
  Keep-Alive requests:    10000
  Total transferred:      2020000 bytes
  HTML transferred:       610000 bytes
  Requests per second:    11571.74 [#/sec](mean)
  Time per request:       864.174 [ms](mean)
  Time per request:       0.086 [ms](mean, across all concurrent requests)
  Transfer rate:          2282.71 [Kbytes/sec] received
  1. hostname
  ab -lkc 10000 -n 10000 'http://app/ok'
  Concurrency Level:      10000
  Time taken for tests:   1.055 seconds
  Complete requests:      10000
  Failed requests:        0
  Keep-Alive requests:    10000
  Total transferred:      2020000 bytes
  HTML transferred:       610000 bytes
  Requests per second:    9476.49 [#/sec](mean)
  Time per request:       1055.243 [ms](mean)
  Time per request:       0.106 [ms](mean, across all concurrent requests)
  Transfer rate:          1869.39 [Kbytes/sec] received
  1. 服务发现
  ab -lkc 10000 -n 10000 'http://app.local/ok'
  Concurrency Level:      10000
  Time taken for tests:   4.276 seconds
  Complete requests:      10000
  Failed requests:        0
  Keep-Alive requests:    10000
  Total transferred:      3000000 bytes
  HTML transferred:       610000 bytes
  Requests per second:    2338.60 [#/sec](mean)
  Time per request:       4276.066 [ms](mean)
  Time per request:       0.428 [ms](mean, across all concurrent requests)
  Transfer rate:          685.14 [Kbytes/sec] received
  1. HTTP SLB
  ab -lkc 10000 -n 10000 'http://192.168.1.10/ok'
  Concurrency Level:      10000
  Time taken for tests:   6.308 seconds
  Complete requests:      10000
  Failed requests:        0
  Non-2xx responses:      580
  Keep-Alive requests:    10000
  Total transferred:      2141800 bytes
  HTML transferred:       732380 bytes
  Requests per second:    1585.41 [#/sec](mean)
  Time per request:       6307.517 [ms](mean)
  Time per request:       0.631 [ms](mean, across all concurrent requests)
  Transfer rate:          331.60 [Kbytes/sec] received

同时10000个并发请求,有580个请求SLB nginx返回了504错误,以下为response。

  <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  <html>
  <head><title>504 Gateway Time-out</title></head>
  <body bgcolor="white">
  <h1>504 Gateway Time-out</h1>
  <p>The gateway did not receive a timely response from the upstream server or application.</body>
  </html>

  WARNING: Response code not 2xx (504)
  1. TCP SLB
  ab -lkc 10000 -n 10000 'http://192.168.1.40/ok'
  Concurrency Level:      10000
  Time taken for tests:   1.891 seconds
  Complete requests:      10000
  Failed requests:        0
  Keep-Alive requests:    10000
  Total transferred:      2020000 bytes
  HTML transferred:       610000 bytes
  Requests per second:    5287.14 [#/sec](mean)
  Time per request:       1891.383 [ms](mean)
  Time per request:       0.189 [ms](mean, across all concurrent requests)
  Transfer rate:          1042.97 [Kbytes/sec] received

测试结果

并发请求10000次,每秒处理的请求数如下表:

访问方式 吞吐量(RPS)
docker link 11571.74
hostname 9476.49
服务发现 2338.60
HTTP SLB 1585.41
TCP SLB 5287.14

结论:

  1. 从数据上看,使用docker link机制访问服务,无论是延迟和吞吐量都是最好的,hostname方式其次
  2. 同是 HTTP 模式的服务发现和HTTP SLB,性能最差
  3. HTTP SLB的并发性能似乎并不理想,10000个请求有5.8%的请求返回了504 Gateway错误

问题:

虽然docker link和hostname网络性能最佳,但不清楚其负载能力如何。测试中我们发现hostname方式是具有负载能力的,不过在官方帮助文档中,hostname访问方式被放在『不具备负载均衡能力的访问方式』中,而且被描述为『能做到一定的负载均衡的作用』。可见阿里云并没有强调其负载能力。如果在生产环境中使用,负载均衡能力也是相当重要的一个指标。

最后,这两个问题还需要向阿里云进一步确认:

  1. link和hostname模式的负载能力到底如何?
  2. 对于具备负载衡量能力、HTTP模式,内网使用这三个要求,是否有推荐使用的网络模式?
相关实践学习
Docker镜像管理快速入门
本教程将介绍如何使用Docker构建镜像,并通过阿里云镜像服务分发到ECS服务器,运行该镜像。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
目录
相关文章
|
2月前
|
网络协议 Shell Linux
【Shell 命令集合 网络通讯 】⭐⭐⭐Linux 测试与目标主机之间的网络连接ping 命令 使用指南
【Shell 命令集合 网络通讯 】⭐⭐⭐Linux 测试与目标主机之间的网络连接ping 命令 使用指南
46 1
|
1月前
|
Cloud Native Linux 网络虚拟化
深入理解Linux veth虚拟网络设备:原理、应用与在容器化架构中的重要性
在Linux网络虚拟化领域,虚拟以太网设备(veth)扮演着至关重要的角色🌐。veth是一种特殊类型的网络设备,它在Linux内核中以成对的形式存在,允许两个网络命名空间之间的通信🔗。这篇文章将从多个维度深入分析veth的概念、作用、重要性,以及在容器和云原生环境中的应用📚。
深入理解Linux veth虚拟网络设备:原理、应用与在容器化架构中的重要性
|
13天前
|
安全 测试技术 网络架构
【专栏】编写网络设备割接方案的七个步骤,包括明确割接目标、收集信息、制定计划、设计流程、风险评估、准备测试环境和编写文档。
【4月更文挑战第28天】本文介绍了编写网络设备割接方案的七个步骤,包括明确割接目标、收集信息、制定计划、设计流程、风险评估、准备测试环境和编写文档。通过实际案例分析,展示了如何成功完成割接,确保业务连续性和稳定性。遵循这些步骤,可提高割接成功率,为公司的网络性能和安全提供保障。
|
2天前
|
运维 安全 Linux
深入理解Docker自定义网络:构建高效的容器网络环境
深入理解Docker自定义网络:构建高效的容器网络环境
|
11天前
|
分布式计算 Hadoop 测试技术
|
11天前
|
分布式计算 Hadoop 测试技术
|
11天前
|
分布式计算 Hadoop 测试技术
Hadoop节点网络性能的带宽测试
【4月更文挑战第23天】
24 1
|
12天前
|
分布式计算 安全 Hadoop
Hadoop节点网络性能测试时延测试
【4月更文挑战第22天】
27 2
|
12天前
|
分布式计算 Hadoop 测试技术
Hadoop节点网络性能的带宽测试
【4月更文挑战第22天】
29 4
|
12天前
|
分布式计算 Hadoop 测试技术
Hadoop节点网络性能测试准备测试工具
【4月更文挑战第22天】选择合适的网络性能测试工具对于评估Hadoop集群的网络性能至关重要。这些工具可以帮助我们收集准确的数据,为优化集群配置和性能提供有力的支持。
21 1

相关产品

  • 容器计算服务