对OpenStack内存使用情况的分析

对OpenStack内存使用情况的分析

作者:张航东

版本:Kilo

 

1. How many processes OpenStack hold?

In this chapter, the specs of OpenStack were 4U, 16G, just for example.


1.1 How to check the process number
At first, let’s use nova-api as an example, to explain how to check the process number.

nova-api has 1 main process, and 12 child processes. We can see them by the command:
[root@osc~]# ps -eo pid,ppid,uid,vsz,rss,args | grep nova

 
We can find out its starting function by the following steps. (So do other services)


 

In /nova/cmd/api.py

 
There are 3 parts in above codes.
1) “for” each “api” in CONF.enabled_apis. We can see there are 3 apis in the field in nova.conf, this mean all nova-api processes include 3 types of api (ec2, osapi_compute, metadata)

 
2) Server = service.WSGIService() initialize the server, and set workers which will define the number of each api. In nova/service.py:

 
The “worker” comes from “%s_workers” (ec2, osapi_compute, metadata) field in nova.conf. The value is as same as the number of CPUs available, and set by packstack when install OpenStack.


3) Launcher.launch_service(server, workers) start the child processes for each api, and the number of the processes are determined by the number of worker. In nova\openstack\common\service.py:

 

According to above analysis, we can summarize that:
nova-api process number = 1 (main process) + 4 (the number of CPUs) * ec2 api service + 4 * osapi service + 4 * metadata service = 13.

 

1.2     Controller
1.2.1     Nova


The formula of total processes is: 6 + 4 * CPUs

1.2.2     Neutron

 

 
The formula of total processes is: 1 + 2 * CPUs


1.2.3     Cinder


 
The formula of total processes is: 3 + 1 * CPUs + backend num


1.2.4     Keystone


 

PS: no child process when both of public_workers and admin_workers are 1, because of the following restraint: (In /keystone/server/eventlet.py)


The formula of total processes is: 1 + 2 * CPUs


1.2.5     Glance



The formula of total processes is: 2 + 2 * CPUs


1.2.6     Ceilometer



The formula of total processes is: 6 + 2 * CPUs (>1)


1.2.7     Httpd


Only 3 processes belong to OpenStack, and we can change it in “/etc/httpd/conf.d/15-horizon_vhost.conf”:

 
1.2.8     Others
And, there is only 1 process for each other backend services (mariadb, mongod, rabbitmq, redis, memcached).

1.3     Compute



In every compute node, each OpenStack service only holds 1 process.

 

2.     How much memory OpenStack consume?
According to the above analysis, we known the number of processes of each OpenStack service are decided by CPUs number in default.

So, this chapter, we will see the memroy consumption from each of them to all of controller.


2.1     Pre-testing
First of all, I wrote a script to get the maximum memory consumption while install OpenStack, and made some practices and get some conclusions.


Below show the point when most memeory consumed while install.


2.1.1     Case 1 - diff cpu, same memory
Installed 6 OpenStack environments with different CPU specs (4u/8u/16u/24u/36u/48u), and same memory specs (16g) . Then, got following datas from controller: 


Assumption 1: Memory consumption on controller will conspicuously increase with CPU number.

And, after installed, when I keep running “free” command on controller, I found the memory consumption would keep raising.


Assumption 2: Controller may need more memroy for running than installing

2.1.2     Case 2 - same cpu, diff memory
Installed 4 OpenStack environments with same CPU specs (16u), and different memory specs (8g/16g/32g/64g). Then, got following datas from controller:

 
Assumption 3: Memory consumption on controller will increase with memory too, but inconspicuously.


Assumption 4: If reinstall OpenStack after destroy, while install, it will need less memory than the first time.

2.1.3     Case 3 - diff number of compute nodes
Installed 5 OpenStack environments with same CPU specs (16u), same memory specs (16g), but different number of compute nodes (1/2/4/8/16).  Then, got following datas from controller:

 

Assumption 5: Memory consumption on controller will increase with the number of compute nodes.

2.1.4     Case 4 - diff capacities of compute nodes


 
Assumption 6: the memory consumption on compute are different under different capacities. and much less than total memory.

2.2     Consumption of each process
For the memory consumption of each process, does it affected by CPUs number or memory?
According to my verification. The answer is No.
 
2.2.1     Controller
The following table show the average memory consumption of each type of process.

 

 

 

 

 


The memory consumption of other services (httpd, mariadb, mongod, rabbitmq, redis, memcached) has less difference (<50M in total) between different VCUs number.

2.2.2     Compute

 


2.3     Consumption in theory (controller)
According to above datas. We can see, in different CPUs number, the difference of memory consumption is main decided by OpenStack processes (mark with green shade).
To summarize them, we can get a formula:
The difference of memory consumption (RSS) / CPU =
    (69180 + 123624 + 89988 + 83380) + (59652 + 56136) + (57648) + (77188 + 79476) + (60920 + 60432)
                            Nova                                    neutron            cinder           keystone                  glance
    ≈ 818 MB
This mean, if we install Opentack on the Host/VM which has one more CPU than another, in theory, it will consume more 818 MB memory.

But, in deed, the value in actual environment is much lesser than it.

2.4     Consumption in deed (controller)
I built an environment (16u/16u, 1 compute) and manually changed the “workers” in conf file to simulate different CPU number. And got the following “used” memeory 1 hour after restarted OpenStack service:


Then, we can see a smooth increasing line. And summarize:

 
The difference of memory consumption / CPU
    = ((13564544 - 12907380) + (12907380 - 12573920) + (12573920 - 11927552) + …… + (32315602432376)) / (2 * 23)
               48U            46U                46U             44U               44U             42U                            4U             2U
    = ((13564544 - 2432376) / (2 * 23)
                48U          2U
    ≈ 242 MB

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OpenStack是一个开源的云计算平台,它由一系列的开源软件组成。其中包括但不限于以下几个主要组件: 1. Nova:用于管理计算资源的组件,包括虚拟机、容器等。 2. Neutron:用于管理网络资源的组件,包括虚拟网络、路由器等。 3. Cinder:用于管理块存储的组件,包括卷、快照等。 4. Glance:用于管理镜像的组件,包括虚拟机镜像、容器镜像等。 5. Keystone:用于管理身份认证和授权的组件,包括用户、角色、权限等。 6. Horizon:用于提供Web界面的组件,包括控制台、仪表盘等。 7. Swift:用于管理对象存储的组件,包括对象、容器等。 8. Heat:用于管理编排的组件,包括自动化部署、自动化扩展等。 9. Ceilometer:用于管理监控的组件,包括指标、告警等。 10. Trove:用于管理数据库的组件,包括MySQL、MongoDB等。 11. Sahara:用于管理大数据的组件,包括Hadoop、Spark等。 12. Magnum:用于管理容器编排的组件,包括Docker、Kubernetes等。 13. Zun:用于管理容器的组件,包括容器、容器组等。 14. Cyborg:用于管理加速器的组件,包括GPU、FPGA等。 15. Ironic:用于管理裸机的组件,包括物理机、虚拟机等。 16. Manila:用于管理文件存储的组件,包括共享、快照等。 17. Designate:用于管理DNS的组件,包括域名、记录等。 18. Barbican:用于管理密钥的组件,包括加密、解密等。 19. Masakari:用于管理高可用的组件,包括故障检测、故障恢复等。 20. Freezer:用于管理备份的组件,包括备份、还原等。 21. Searchlight:用于管理搜索的组件,包括索引、查询等。 22. Congress:用于管理策略的组件,包括规则、决策等。 23. Watcher:用于管理优化的组件,包括性能、资源等。 24. Aodh:用于管理告警的组件,包括触发、通知等。 25. Octavia:用于管理负载均衡的组件,包括负载均衡器、监听器等。 26. Mistral:用于管理工作流的组件,包括流程、任务等。 27. Rally:用于管理基准测试的组件,包括性能、稳定性等。 28. Senlin:用于管理集群的组件,包括节点、策略等。 29. Vitrage:用于管理根因分析的组件,包括事件、关系等。 30. Blazar:用于管理预留资源的组件,包括CPU、内存等。 31. Tacker:用于管理NFV的组件,包括虚拟网络、虚拟机等。 32. Qinling:用于管理函数计算的组件,包括函数、触发器等。 33. Airship:用于管理云原生的组件,包括Kubernetes、Helm等。 34. StarlingX:用于管理边缘计算的组件,包括节点、集群等。 35. OpenStack-Helm:用于管理OpenStack的组件,包括部署、升级等。 36. OpenStack-Ansible:用于管理OpenStack的组件,包括部署、升级等。 37. Kolla-Ansible:用于管理容器化的OpenStack的组件,包括部署、升级等。 38. TripleO:用于管理OpenStack的组件,包括部署、升级等。 39. Packstack:用于管理OpenStack的组件,包括部署、升级等。 40. DevStack:用于管理OpenStack的组件,包括部署、测试等。 41. OpenStackClient:用于管理OpenStack的命令行工具,包括CLI、SDK等。 42. Python-OpenStackSDK:用于管理OpenStack的Python SDK,包括API、文档等。 43. OpenStack-Analytics:用于管理OpenStack的数据分析,包括报告、可视化等。 44. OpenStack-Health:用于管理OpenStack的健康检查,包括监控、诊断等。 45. OpenStack-Security:用于管理OpenStack的安全性,包括漏洞、修复等。 46. OpenStack-Training:用于管理OpenStack的培训,包括课程、认证等。 47. OpenStack-User-Stories:用于管理OpenStack的用户案例,包括分享、交流等。 48. OpenStack-Interop:用于管理OpenStack的互操作性,包括标准、测试等。 49. OpenStack-Community:用于管理OpenStack的社区,包括贡献、活动等。 50. OpenStack-Foundation:用于管理OpenStack的基金,包括管理、支持等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值