thinkjs / thinkjs/thinkjs

压力测试,并发时会导致数据库连接中断,Error: read ECONNRESET

Open
#1,293 9 comments 0 reactions 1 assignee View on GitHub

@lidongjies is already working on this.

Since Dec 19, 2018.

Dominant language
JavaScript
Stars
5.3k
Forks
614
PR merge metrics
No merged PRs in 30d

Description

压力测试,50并发时会导致数据库连接中断

ENV

OS Platform:centOS7.5

Node.js Version:8.9

ThinkJS Version:3.0

code
exports.model = {
  type: 'mysql',
  common: {
    logConnect: isDev,
    logSql: isDev,
    logger: msg => think.logger.info(msg)
  },
  mysql: {
    handle: mysql,
    database: 'xxx',
    prefix: '',
    encoding: 'utf8',
    charset:'UTF8MB4_GENERAL_CI',
    host: 'xxx',
    port: '',
    user: 'root',
    password: 'root',
    connectionLimit:10,
    dateStrings: true
  }
};
error message
Error: read ECONNRESET
      at _errnoException (util.js:1024:11)
      at TCP.onread (net.js:615:25)
more description

进行并发压力测试时,但并发达到40-50时,项目会中断与数据库的连接,数据库使用的时mysql,有什么方法能捕捉这种情况并重新连接上数据库

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.