跳转到: 导航, 搜索

KeystonePerformance

Keystone 性能

这是跟踪与 Keystone 相关的性能工作。

工作项

识别 CPU、磁盘、内存、数据库瓶颈

测试 #1,并行创建用户并查找 CPU、磁盘或内存瓶颈。
方法论
  1. 在裸机上安装 Havana Stable [1]
  2. 创建一种 m1.medium 规格的实例,另一种 m1.large 类型的实例,以便我们可以拥有不同的 CPU 和内存配置
  3. 在上述两个创建的实例上手动安装 Keystone
  4. 使用 python multiprocessing 模块,使用 keystoneclient.v2_0 模块在每个实例上并行创建用户。
    1. key.users.create(<user>, "test", "test@test.com") 其中 key = client.Client( .... )
  5. 在用户创建过程中收集与 CPU、磁盘、内存和数据库相关的统计信息。

缓存效果 - memcached

过期令牌的影响

同步撤销列表的开销

使用多核 Keystone 服务带来的改进

比较 PKI 与 UUID,SQL 与 LDAP

方法论

在这个故事中,我们将测量那些顺序测试的 Keystone 性能

  • 用户创建
  • 用户令牌生成
  • 用户令牌验证
测试设置

Ubuntu 服务器 13.10 上的 Devstack,禁用大多数服务(除了 Keystone、MySQL 和 LDAP)

for service in g-api g-reg n-api n-crt n-obj n-cpu n-net n-cond \
                     cinder c-sch c-api c-vol n-sch n-novnc n-xvnc n-cauth \
                     horizon rabbit tempest; do
    echo disable_service $service >> localrc
done

在 localrc 的末尾添加

ADMIN_PASSWORD=nomoresecrete
SERVICE_TOKEN=ADMIN
OFFLINE=True

KEYSTONE_TOKEN_FORMAT=UUID
KEYSTONE_IDENTITY_BACKEND=ldap

enable_service ldap
KEYSTONE_CLEAR_LDAP=yes
LDAP_PASSWORD=ldappass
测试脚本

使用的脚本可以在这里找到:https://github.com/TristanCacqueray/keystone-perfs/tree/master/src 基本上

  • 用户创建 (perf-create-users.sh)
  • 生成用户令牌列表 (perf-gen-tokens.sh)
  • 令牌验证 (perf-validate-tokens.sh)

性能数据采集

主要的脚本是 bench.sh,它将实时(用户态 + 内核态)写入 /tmp/perf-test_name-TOKEN_FORMAT-BACKEND

性能结果

请注意,这是一个顺序基准测试(没有并行请求)。 在多次运行数据采集后,以下是针对 100 个项目(用户或令牌)的平均观察时间(秒):

LDAP SQL
UUID
user creation   : 29.36
token generation: 27.74
token validation:  2.29
user creation   : 31.35
token generation: 29.73
token validation:  2.32 
PKI
user creation   : 29.39
token generation: 30.40
token validation: 2.84
user creation   : 31.34
token generation: 32.27
token validation:  2.86

初步观察

  • UUID 令牌生成比 PKI 快(显然)。
  • 用户创建不依赖于令牌类型,并且在 LDAP 上更快。
  • 总体而言,LDAP 性能更好,甚至在令牌验证方面也是如此。

PKI V3 的并发值

描述

在这个故事中,我们将测量 Keystone V3 每秒可以处理多少个 PKI_token_authenticate 或 PKI_token_revocation_list_get 请求。 然后我们将尝试提高该值。

测试环境

主机信息:8 核,24G 内存 操作系统:suse11.2 Keystone 日志级别:WARN Keystone 数据库:postgres sql 令牌格式:PKI Api 版本:V3

方法论

  1. 服务器准备就绪后,客户端进程将开始不断发送顺序请求。
  2. 更改客户端进程的数量,使响应数达到最大值。
  3. 运行客户端进程 20 秒
  4. 计算每秒的并发值。

单个进程 Python-only Keystone 服务器

部署

有两个主机。 一个用于运行客户端进程,另一个用于运行 Keystone 服务器和 SQL 服务器。

性能结果
token_authenticate revocation_list_get
10/s 58/s

在 Apache 容器服务器内运行的多进程 Keystone 服务器

部署

有两个主机。 一个用于运行客户端进程,另一个用于运行在 Apache 内的 Keystone 服务器和 SQL 服务器。

性能结果
token_authenticate revocation_list_get
57/s 330/s

在 Apache 容器服务器内运行的两个多进程 Keystone 服务器

部署

有三个主机:客户端进程、在 Apache 内运行的 Keystone 服务器和 SQL 服务器、在 Apache 内运行的 Keystone 服务器和 haproxy。

性能结果
token_authenticate revocation_list_get
105/s 560/s

在 Apache 容器服务器内运行的三个多进程 Keystone 服务器

部署

有四个主机:客户端进程、在 Apache 内运行的 Keystone 服务器、在 Apache 内运行的 Keystone 服务器和 SQL 服务器、在 Apache 内运行的 Keystone 服务器和 haproxy。

性能结果
token_authenticate revocation_list_get
140/s 800/s

在 Apache 容器服务器内运行的四个多进程 Keystone 服务器

部署

有五个主机:客户端进程、在 Apache 内运行的 Keystone 服务器、在 Apache 内运行的 Keystone 服务器、在 Apache 内运行的 Keystone 服务器和 SQL 服务器、在 Apache 内运行的 Keystone 服务器和 haproxy。

性能结果
token_authenticate revocation_list_get
140/s 1000/s

下一步

通过以上数据,我们发现主机数量从三个增加到四个时,每秒的并发值并没有增加。 我们推测 postgres sql 是瓶颈。 因此,我们将尝试下一步改进 sql。