7

如何解决负载测试产生的“socket: too many open files”

 2 years ago
source link: https://www.v2ex.com/t/814749
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

如何解决负载测试产生的“socket: too many open files”

  JasonLaw · 13 小时 18 分钟前 · 565 次点击

我使用k6进行负载测试,运行的命令为k6 run --stage 5s:250 script.js,script.js 的内容如下:

import { check } from 'k6';
import http from "k6/http";

export default function main(token) {
    let res = http.get(
        "https://{domain}/schedules"
    );

    check(res, {
        'is status 200': (r) => r.status === 200
    });
}

但是输出出现了大量的socket: too many open files,如下图所示:

服务是基于 Spring Boot 的,使用 Nginx 作为 reverse proxy 。要怎么解决“socket: too many open files”这个问题呢?

我尝试过按照ck :: Nginx socket() failed (24: Too many open files)进行修改,但是没有效果。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK