Home  >  Article  >  Backend Development  >  nginx - 峰值4万/s的php接口大概需要多少计算资源?

nginx - 峰值4万/s的php接口大概需要多少计算资源?

WBOY
WBOYOriginal
2016-06-06 20:24:271564browse

php(貌似是yii框架)写的一些接口(没有前端网页),峰值请求大概4万/s(通过分析access.log得出),大概需要多少cpu和内存资源才能扛的住? 求估算的方法和思路

回复内容:

php(貌似是yii框架)写的一些接口(没有前端网页),峰值请求大概4万/s(通过分析access.log得出),大概需要多少cpu和内存资源才能扛的住? 求估算的方法和思路

首先需要明确的几点是:

1.在出现性能瓶颈的时候,不是通过纵向增加cpu和内存(购买更好的服务器)来扛住压力, 而是应该通过横向扩展,通过增加服务器的数量来分摊请求压力。
2.服务器应该关注的是它的吞吐量,尽量在提高资源利用率(cpu、内存使用)的情况下提高吞吐量。

所以下面是我认为合理的估算思路:

首先需要先把程序部署到一台机器上,然后用webbench测试一下这台机器的QPS(系统吞吐量)。 假设得出的单机QPS是1w/s,那就说明需要4台这样的机器通过负载均衡共同来处理请求。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn