68个并发用户访问网站后发生502个网关错误

我在jMeter中进行一些压力testing时遇到了问题。 基本上,我们正在达到68个并发用户的硬性限制。 一旦testing达到这个数量的用户,我们得到502坏的网关错误。

有趣的是,我们得到了68个虚拟机用户和CPU和RAM两倍的故障。 所以这让我相信这是一个configuration问题。 毕竟,每台服务器上的Docker容器之间的configuration是相同的。

我已经尝试提高nginx.conf中的worker_connections设置,但是没有任何效果。 我什至重新启动机器,以确保新的设置被应用。

有什么其他的想法来看看或尝试什么?

我不知道这是否有帮助,但这是我们在nginx服务器上的configuration失败…

upstream unicorn_server { server unix:/app/tmp/unicorn.sock fail_timeout=0; keepalive 512; } server { listen 4043 ssl; ssl_certificate /etc/nginx/certs/hive.crt; ssl_certificate_key /etc/nginx/certs/hive.key; gzip on; gzip_min_length 1000; gzip_proxied expired no-cache no-store private auth; gzip_types application/json; root /app/public; try_files $uri @unicorn_server; keepalive_timeout 10; location @unicorn_server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto https; # if use ssl proxy_redirect off; proxy_pass http://unicorn_server; proxy_http_version 1.1; } location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ { gzip_static on; expires max; add_header Cache-Control public; add_header Last-Modified ""; add_header ETag ""; open_file_cache max=1000 inactive=500s; open_file_cache_valid 600s; open_file_cache_errors on; break; } } 

这可能不是一个网站问题。 这可能发生在您的负载生成器和目标之间的问题。 你能告诉我们更多关于你的testing基础设施吗? 负载生成器相对于被testing的应用程序/服务器位于何处? 你需要遍历代理进行沟通吗? 你可能会如何限制你的请求?