本系列文章着重学习和研究OpenStack Swift,包括环境搭建、原理、架构、监控和性能等。

(1)OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置

(2)原理、架构和性能

(3)监控

对 Swift 集群的监控是必要的,特别是集群规模很大的时候。

1. 监控目标

主要的监控目标包括:

  • 硬件故障
  • 操作系统故障
  • Swift 集群健康状态
  • Swift 集群状态

2. Swift 提供的工具

2.1 Swift 自带的各种 Audit 工具

2.1.1 磁盘监控工具 swift-drive-audit

该工具分析 /var/log/kern.log 文件,根据预定义的 regexp 来探测 kernel 报告的磁盘错误。通常地它会被 cron 周期性地运行。它使用一个配置文件,比如 /etc/swift/drive-audit.conf。如果该脚本发现了某个磁盘存在问题,它会自动 unmount 它,而且会在 /etc/fstab 中将它注释掉。然后后端 replication 进程就会从其它 replica 中拷贝出一个新的 replica。 这是示例配置文件

要使用它,必须首先创建一个配置文件 driver-audit.conf:

[drive-audit]
device_dir = /srv/node
log_facility = LOG_LOCAL0
log_level = INFO
minutes =
error_limit =
log_file_pattern = /var/log/kern*
regex_pattern_1 = \berror\b.*\b(dm-[-]{,}\d?)\b

然后运行该工具:swift-drive-audit driver-audit.conf,然后上面描述的各种 action 就会有了。

2.1.2 account,container 和 object auditor

功能:

  • swift-account-auditor 会打开 account server 的 sqlite db,运行 SQL 查询,确保 db 是有效的,并报告一个account 是否有 replica 缺失或者错误的对象。
  • swift-container-auditor 会对 containers 做同样的事情.
  • swift-object-auditor 会打开一个对象服务器上的所有对象,确保它们的元数据是正确的,而且有有合适的大小和 MD5

它们都必须在各自对应的服务的配置文件中的 [account/object/container-auditor] 部分做相应配置,然后它们就会定期运行,并输出日志。

2.2 集群监控状态获取工具 swift-dispersion-populate 和 swift-dispersion-report

这两个工具用于获取和报告集群的总体健康状态。它需要访问Swift 集群以及 Ring 文件。它需要一个自己的配置文件,往往把该配置文件放在 proxy server 上的 /etc/swift 目录下。

(1)创建配置文件 /etc/swift/dispersion.conf :

[dispersion]

auth_url = http://controller:35357/v3
auth_user = service:swift
auth_version = 3
auth_key = 1111
swift_dir = /etc/swift
concurrency = 25
retries = 5

该配置文件的详细说明可以参见 Ubuntu 文档。注意 Kilo 版本的 Swift 环境中需要添加配置项 auth_version。

(2)运行 swift-dispersion-populate 去获取系统的健康状况,它和 swift-dispersion-report 使用同一个配置文件。详细说明可以参见 Ubuntu 文档

root@swift1:/etc/swift# swift-dispersion-populate dispersion.conf
Created containers for dispersion reporting, 0s, retries
Created objects for dispersion reporting, 0s, retries

(3)运行  swift-dispersion-report 获取监控报告。详细说明请参加 Ubuntu 文档

root@swift1:/etc/swift# swift-dispersion-report
Queried 11 containers for dispersion reporting, 0s, 0 retries
100.00% of container copies found (33 of 33)
Sample represents 1.07% of the container partition space
Queried 10 objects for dispersion reporting, 0s, 0 retries
There were 10 partitions missing 0 copy.
100.00% of object copies found (30 of 30)
Sample represents 0.98% of the object partition space

2.3 性能获取工具 swift-recon 中间件

2.3.1 它是什么(what)

Swift Recon是一个安装在对象服务器的pipeline上的中间件,它有一个必填选项:一个本地缓存目录。它可以获取:

  1. How many unmounted (failed) drives there are in the cluster, and on which servers those are located
  2. How many async pendings are present
  3. Drive usage and balance
  4. Load Average (for easy access later on*)
  5. Memory Usage (for easy access later on*)
  6. Checking ring md5sum’s
  7. Logged replication stats
  8. Connection stats (tbd)
  9. Quarantine Statistics (a new pending addition)

要使用它,需要首先修改 object-server 的配置文件,添加该中间件:

[pipeline:main]
pipeline = healthcheck recon object-server [filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock

2.3.2 使用命令行工具(How)

swift-recon   <server_type>  [-v] [--suppress] [-a] [-r] [-u] [-d] [-l]  [--md5] [--auditor] [--updater] [--expirer] [--sockstat]

参数:

  • -a, --async: Get async stats
  • --auditor: Get auditor stats
  • --updater: Get updater stats
  • --expirer: Get expirer stats
  • -r, --replication: Get replication stats
  • -u, --unmounted: Check cluster for unmounted devices
  • -d, --diskusage: Get disk usage stats
  • -l, --loadstats: Get cluster load average stats
  • -q, --quarantined: Get cluster quarantine stats
  • --md5 Get md5sum of servers ring and compare to local cop
  • --all Perform all checks. Equivalent to -arudlq --md5
  • -z ZONE, --zone=ZONE: Only query servers in specified zone
  • --swiftdir=PATH Default = /etc/swift

(1)获取全部zone 上 updater,auditor 和 expier 的状态

root@swift1:/etc/swift# swift-recon --auditor --updater --expirer
===============================================================================
--> Starting reconnaissance on hosts
===============================================================================
[-- ::] Checking auditor stats
[ALL_audit_time_last_path] low: , high: , avg: 0.0, total: , Failed: 0.0%, no_result: , reported:
[ALL_quarantined_last_path] low: , high: , avg: 0.0, total: , Failed: 0.0%, no_result: , reported:
[ALL_errors_last_path] low: , high: , avg: 0.0, total: , Failed: 0.0%, no_result: , reported:
[ALL_passes_last_path] low: , high: , avg: 1.0, total: , Failed: 0.0%, no_result: , reported:
[ALL_bytes_processed_last_path] low: , high: , avg: 5.0, total: , Failed: 0.0%, no_result: , reported:
[ZBF_audit_time_last_path] low: , high: , avg: 0.0, total: , Failed: 0.0%, no_result: , reported:
[ZBF_quarantined_last_path] low: , high: , avg: 0.0, total: , Failed: 0.0%, no_result: , reported:
[ZBF_errors_last_path] low: , high: , avg: 0.0, total: , Failed: 0.0%, no_result: , reported:
[ZBF_bytes_processed_last_path] low: , high: , avg: 0.0, total: , Failed: 0.0%, no_result: , reported:
===============================================================================
[-- ::] Checking updater times
[updater_last_sweep] low: , high: , avg: 0.1, total: , Failed: 0.0%, no_result: , reported:
===============================================================================
[-- ::] Checking on expirers
[object_expiration_pass] - No hosts returned valid data.
[expired_last_pass] - No hosts returned valid data.
===============================================================================

(2)磁盘使用情况

root@swift1:/etc/swift# swift-recon -d
===============================================================================
--> Starting reconnaissance on hosts
===============================================================================
[-- ::] Checking disk usage now
Distribution Graph:
% **********************************************
% *********************************************************************
% ***********************
Disk usage: space used: of
Disk usage: space free: of
Disk usage: lowest: 2.59%, highest: 4.56%, avg: 3.31952247191%

(3)系统负载

root@swift1:/etc/swift# swift-recon -l
===============================================================================
--> Starting reconnaissance on hosts
===============================================================================
[-- ::] Checking load averages
[5m_load_avg] low: , high: , avg: 0.1, total: , Failed: 0.0%, no_result: , reported:
[15m_load_avg] low: , high: , avg: 0.1, total: , Failed: 0.0%, no_result: , reported:
[1m_load_avg] low: , high: , avg: 0.1, total: , Failed: 0.0%, no_result: , reported:

(4)检查所有节点上的 ring 文件和 swift.conf 是不是完全一致

root@swift1:/etc/swift# swift-recon --md5
===============================================================================
--> Starting reconnaissance on hosts
===============================================================================
[-- ::] Checking ring md5sums
/ hosts matched, error[s] while checking hosts.
===============================================================================
[-- ::] Checking swift.conf md5sum
/ hosts matched, error[s] while checking hosts

2.3.2 通过 REST API 使用

URL 及功能列表:

3. 其它监控工具

Swift 自身带的监控工具能提供比较丰富的功能,但是使用起来还不是很方便,因此,业界已经出现了很多商业的或者开源的监控工具。这些监控工具,要么向 swift-recon 一样实现了一个新的中间件,要么调用 Swift 自身的工具提供的接口。 以下(1 - 4 部分)文字引用自 OpenStack Object Storage Monitoring 一文:

(1)Swift-Informant

Florian Hines 开发的 Swift-Informant 中间件可以获得 OS 客户请求的实时结果。它位于proxy server的 pipeline,在每一个请求到达Proxy server之后,它发送3类统计数据到StatsD server.

  • 一个类似obj.GET.200 or cont.PUT.404的增量计数器。
  • 请求处理的时间长度
  • 传输数据数量

  这有利于了解客户正体验的服务品质,也可以了解各种服务类型,命令以及响应码的不同排列的数量。Swift-Informant也要求no change to core Swift code因为它是用中间件实现的。然而,也因为如此,它不能让人看到代理服务器后面的工作情景。如果一个存储节点的响应降低,你也可能看到你的请求变差-要么是高延迟,要么返回错误状态码。你不会知道具体是为什么,或者请求是要去哪里。或许你所考虚的container服务器是在一个好的节点的,而对象服务器是在另一个性能差的节点。
因此我们需要深入视觉到proxy server的后面,集群的操作里去。

(2)Statsdlog
  Florian 的 statsdlog 工程增加了 StatsD 基于日志事件的计数器。正如Swift-Informant,它也是非侵入式的。但是statsdlog可以从Swift后台进程中追踪事件,而不仅仅是代理服务器。后台进程监听syslog信息的UDP流,当一条日志匹配于一个正则表达式时,StatsD计数器递增。Metric名字映射到JSON文件中的正则pattern。JSON文件允许灵活配置以能从日志流中抽取出想要的metrics。

(3)Swift StatsD Logging
  StatsD 使用程序代码来作深入分析。Metrics被有针对性的代码实时发送。发送一个metric的开销相当低:一个sendto UDP包。如果你认为这样的开销还算高的话,StatsD client library可以只发送样本的随机比率部分,flushing metrics upstream时StatsD将估算实际数据。要避免基于中间件的监控与事后日志处理所带来的弊端,我们把StatsD metrics发送过种整合到Swift本身。我们当前所提交的更改报告了遍布15个swift后台进程的124个metrics以及tempauth中间件。metrics细节可参考https://review.openstack.org/#patch,sidebyside,6058,2,doc/source/admin_guide.rst

(4)总结

我们认为 Swift 集群动作最好的监控方法是综合了一个通用服务器监控系统,一个Swift特定统计指标收集(polling Swift-specific gauge metrics)机制,一个Swift内部counter与timing metrics深度StatsD日志手段的结合体。对于polling Swift-specific gauge metrics,最好使用一个通用的收集插件。这个插件即可以从swift-recon读数据,也可以自己直接收集信息。在 SwiftStack,我们使用 collectd 加上一些服务器监控用 python 插件代码。我们也在collectd中嵌入StatsD服务器,这样每个节点都有一个进程将stats数据“倒”给Graphite"(http://graphite.wikidot.com/)集群。有了这个装置,我们拥有前述所有问题的全覆盖解决方案:general purpose monitoring, Swift-specific gauge monitoring, and real-time counter and timing data directly from Swift。除了图形化,你也可以实现异常检测,触发警告,维护一个实时的实体健康状态视图,避免各种突发问题。

(5)SwiftStack 监控工具的部分截图:

(6)另外一个监控环境示例

(7)Benchmarking 工具

Intel 开源了对象存储的 Benchmarking 工具 COSBench,https://github.com/intel-cloud/cosbench

4. 一些影响性能的因素

注:以下内容引用自 "Leveraging open source tools to gain insight into OpenStack Swift“ ,by Michael Factor,Dmitry Sotnikov, dmitrys@il.ibm.com。他们使用的测试环境:

4.1 Container 数量和 Swift 版本

(PUT 操作)

版本和 container 数目带来的性能差异还是非常大的。建议使用 Swift 2.2 版本以上,以及多个 container。

4.2 客户端 worker 数目

可见客户端 worker 数目不是越多性能就会线性增加。

4.3 Container 中的对象数目

4.4 前端和后端网络带宽

说明后端网络的带宽压力是前端的至少3倍。

4.5 存储节点的磁盘I/O 和前端网络 I/O 的关系(12倍)

4.6 对象大小

这说明 Swift 不合适处理大量的小文件。

4.7 IOPS 性能不是随着存储节点数目线性扩展的

也就是说这个环境中,存储节点数目为7的话,它们就不是 IOPS 性能瓶颈了。

参考文档:

理解 OpenStack Swift (3):监控和一些影响性能的因素 [Monitoring and Performance]的更多相关文章

  1. Java EE (11) - 影响性能的因素

    垂直层(Tier)影响性能的因素 资源层数据库性能通常考虑以下方面的优化(MySQL为例):--使用哪种存储引擎:MyISAM vs. InnoDB, MERGE, MEMORY, Federated ...

  2. 理解 OpenStack Swift (2):架构、原理及功能 [Architecture, Implementation and Features]

    本系列文章着重学习和研究OpenStack Swift,包括环境搭建.原理.架构.监控和性能等. (1)OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置 ( ...

  3. 理解 OpenStack Swift (1):OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置

    本系列文章着重学习和研究OpenStack Swift,包括环境搭建.原理.架构.监控和性能等. (1)OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置 ( ...

  4. redis性能测试以及影响性能的因素

    redis-benchmark测试工具的命令使使用方法及参数如下:redis-benchmark [-h <host>] [-p <port>] [-c <clients ...

  5. mysql中影响数据库性能的因素讲解

    mysql中影响数据库性能的因素讲解 在本篇文章中我们给大家讲述了mysql中影响性能的因素以及相关知识点内容,有兴趣的朋友参考下 关于数据库性能的故事 面试时多多少少会讲到数据库上的事情,“你对数据 ...

  6. 从系统的角度分析影响程序执行性能的因素——SA20225205 黄兴宇

    实验总结分析报告:从系统的角度分析影响程序执行性能的因素 1.请您根据本课程所学内容总结梳理出一个精简的Linux系统概念模型,最大程度统摄整顿本课程及相关的知识信息,模型应该是逻辑上可以运转的.自洽 ...

  7. 理解 OpenStack 高可用(HA)(1):OpenStack 高可用和灾备方案 [OpenStack HA and DR]

    本系列会分析OpenStack 的高可用性(HA)概念和解决方案: (1)OpenStack 高可用方案概述 (2)Neutron L3 Agent HA - VRRP (虚拟路由冗余协议) (3)N ...

  8. 理解 OpenStack + Ceph (2):Ceph 的物理和逻辑结构 [Ceph Architecture]

    本系列文章会深入研究 Ceph 以及 Ceph 和 OpenStack 的集成: (1)安装和部署 (2)Ceph RBD 接口和工具 (3)Ceph 物理和逻辑结构 (4)Ceph 的基础数据结构 ...

  9. 【转载】OpenStack Swift学习笔记

    免责声明:     本文转自网络文章,转载此文章仅为个人收藏,分享知识,如有侵权,请联系博主进行删除.     原文作者:崔炳华      原文地址:http://blog.csdn.net/i_ch ...

随机推荐

  1. Perfect Scrollbar – 完美的 jQuery 滚动条插件

    Perfect Scrollbar 是一个很小的,但完美的 jQuery 滚动插件.滚动条不会影响原来的设计布局,滚动条的设计是完全可定制的.你可以改变几乎所有的 CSS 样式的滚动条,滚动条设计对脚 ...

  2. 基于 Bootstrap 的响应式后台管理面板

    你想建立一个后台管理面板或者分析仪表板吗?不需从头开始,Keen IO Bootstrap 是一个响应式的仪表盘模板,可以帮助你在几分钟内呈现数据,让你可以创建一个有吸引力的,定制的分析仪表板,随时可 ...

  3. HTML中表单提交数据GET、POST的区别

    表单提交数据Get和Post的区别: GET和POST是表单提交数据其中的两种方式,除此之外还有PUT.DELETE等. GET: GET的请求起因于正常的URL请求,或是没有指定METHOD的HTM ...

  4. JavaScript强化教程——jQuery AJAX 实例

    什么是 AJAX?AJAX = 异步 JavaScript 和 XML(Asynchronous JavaScript and XML).简短地说,在不重载整个网页的情况下,AJAX 通过后台加载数据 ...

  5. Hadoop 2.5.1集群安装配置

    本文的安装只涉及了hadoop-common.hadoop-hdfs.hadoop-mapreduce和hadoop-yarn,并不包含HBase.Hive和Pig等. http://blog.csd ...

  6. 实验9:Problem G: 克隆人来了!

    想要输出""的话: cout<<"A person whose name is \""<<name<<" ...

  7. vbs操作excel

    航天金税系统升级,导出的Excel文件格式与原来有的差异,老的数据导入程序识别不了该文件,对比了新老文件后,发现新文件在专票和普票的“份数”行前增加了一行,同时增加了“单据号”列,通过脚本 把这些删除 ...

  8. android tools使用方式

    我们希望在布局中显示测试的属性,而这个属性不会影响到正式代码,因此我们就需要tools这个命名空间. 首先定义:xmlns:tools="http://schemas.android.com ...

  9. 115个Java面试题和答案——终极列表(下)

    第一篇讨论了面向对象编程和它的特点,关于Java和它的功能的常见问题,Java的集合类,垃圾收集器,本章主要讨论异常处理,Java小应用程序,Swing,JDBC,远程方法调用(RMI),Servle ...

  10. MVC中的时间js格式化

    记录下我遇到的一个,MVC中post请求返回一个JSON字符串,其中包含数据库中的时间格式(如:/Date(10000000000)/),不知道怎么处理.百度的方法都不适用,经自己研究,做成了一个Jq ...