问题描述
我在阿里云有 serverless 服务器,最少有 30 个副本(每个 4C8G)。
当以 15k 并发用户运行负载测试时,服务器复制到 90 个副本,这很奇怪。 90个副本对于15k并发请求来说太多了。
每个 API 的正常响应时间小于 100 毫秒。运行15k负载测试时,响应时间在1-4秒之间。
当我调查时,每个复制只能支持少于 200 个请求,这导致无服务器复制那么多。
4C8G只支持小于200请求并发用户,CPU满100%正常吗?我检查 htop
4C 已满,但 RAM 使用了大约 2-3 GB
下面是我的配置;
Docker - Webdevops Ubuntu
Nginx
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 10000;
}
默认.conf
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_buffers 16 32k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 180s;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s;
}
www.conf
pm = dynamic
pm.max_children = 70
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 60
user = www-data
group = www-data
Opcache
opcache.enable=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=64
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0
opcache.save_comments=1
opcache.fast_shutdown=1
composer.json
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump","@php artisan package:discover --ansi","@php artisan config:cache","@php artisan view:clear","@php artisan view:cache","@php artisan route:cache","@php artisan storage:link","@php artisan queue:restart","@php artisan ide-helper:generate","@php artisan ide-helper:meta"
有没有我遗漏的配置?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)