在负载测试我的 api 每秒 2500 次时,出现以下错误

On load testing my api for 2500 per second, following error came

我有一个 api,它读取 table 中的行数,然后将特定数据保存在 table.Db 中 mysql。在负载测试我的 api 每秒 2500 次点击时,通信 link 错误 came.Error 是:


2019-08-01 18:28:26:478 [91b1bc2f1259de35/91b1bc2f1259de35] [http-nio-80-exec-149] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 5,235 milliseconds ago.  The last packet sent successfully to the server was 5,235 milliseconds ago.
2019-08-01 18:28:26:482 [94a83dcaff8f64bf/94a83dcaff8f64bf] [http-nio-80-exec-160] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 2,962 milliseconds ago.  The last packet sent successfully to the server was 2,962 milliseconds ago.
2019-08-01 18:28:26:500 [17b1c2d0e038602d/17b1c2d0e038602d] [http-nio-80-exec-174] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 1,824 milliseconds ago.  The last packet sent successfully to the server was 1,824 milliseconds ago.
2019-08-01 18:28:26:478 [c18b3bcfe063c93c/c18b3bcfe063c93c] [http-nio-80-exec-170] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 2,072 milliseconds ago.  The last packet sent successfully to the server was 2,072 milliseconds ago.
2019-08-01 18:28:26:478 [06da8ae0c3f60282/06da8ae0c3f60282] [http-nio-80-exec-168] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 2,125 milliseconds ago.  The last packet sent successfully to the server was 2,125 milliseconds ago.
2019-08-01 18:28:26:500 [67ccdca788431e36/67ccdca788431e36] [http-nio-80-exec-179] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 1,893 milliseconds ago.  The last packet sent successfully to the server was 1,893 milliseconds ago.
2019-08-01 18:28:26:478 [1f8fe32ba4ea4133/1f8fe32ba4ea4133] [http-nio-80-exec-127] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 766 milliseconds ago.  The last packet sent successfully to the server was 1,286 milliseconds ago.
2019-08-01 18:28:26:500 [690697c5aff7d7ba/690697c5aff7d7ba] [http-nio-80-exec-169] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 1,523 milliseconds ago.  The last packet sent successfully to the server was 1,523 milliseconds ago.
2019-08-01 18:28:26:500 [a77288b5347b2112/a77288b5347b2112] [http-nio-80-exec-177] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 1,903 milliseconds ago.  The last packet sent successfully to the server was 1,903 milliseconds ago.
2019-08-01 18:28:26:500 [61a6e4bbeedcdea1/61a6e4bbeedcdea1] [http-nio-80-exec-156] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 2,414 milliseconds ago.  The last packet sent successfully to the server was 2,414 milliseconds ago.
2019-08-01 18:28:26:478 [a99d138ae705007d/a99d138ae705007d] [http-nio-80-exec-191] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 1,538 milliseconds ago.  The last packet sent successfully to the server was 1,538 milliseconds ago.
2019-08-01 18:28:26:478 [9f5c21bbd7707b46/9f5c21bbd7707b46] [http-nio-80-exec-161] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 2,348 milliseconds ago.  The last packet sent successfully to the server was 2,348 milliseconds ago.
2019-08-01 18:28:26:500 [fbebe6351a9a638f/fbebe6351a9a638f] [http-nio-80-exec-158] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 2,775 milliseconds ago.  The last packet sent successfully to the server was 2,775 milliseconds ago.
2019-08-01 18:28:26:482 [e9b3c26cf69f2c13/e9b3c26cf69f2c13] [http-nio-80-exec-164] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 2,615 milliseconds ago.  The last packet sent successfully to the server was 2,615 milliseconds ago.
2019-08-01 18:28:26:478 [e0101aee3c7a1bb4/e0101aee3c7a1bb4] [http-nio-80-exec-172] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 1,951 milliseconds ago.  The last packet sent successfully to the server was 1,951 milliseconds ago.
2019-08-01 18:28:26:500 [d9655f8dd1f9e70f/d9655f8dd1f9e70f] [http-nio-80-exec-186] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 1,842 milliseconds ago.  The last packet sent successfully to the server was 1,842 milliseconds ago.
2019-08-01 18:28:26:482 [c6fa3fdf7ec1dc3e/c6fa3fdf7ec1dc3e] [http-nio-80-exec-153] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 3,874 milliseconds ago.  The last packet sent successfully to the server was 4,608 milliseconds ago.
2019-08-01 18:28:26:482 [8d46ab20a948fc91/8d46ab20a948fc91] [http-nio-80-exec-167] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

The last packet successfully received from the server was 2,755 milliseconds ago.  The last packet sent successfully to the server was 2,755 milliseconds ago.
2019-08-01 18:28:26:500 [e01cf78be1b030d7/e01cf78be1b030d7] [http-nio-80-exec-154] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions 142 - Communications link failure

查看 MySQL Communication Link Failure 篇文章:

  1. 确保设置 Validation Query
  2. 为此确保 monitor your MySQL server instance as it might be the case the MySQL server is overloaded and dies or runs into state when it cannot accept new network connections. You can use JMeter PerfMon Plugin

实际上,如果您不能为较少数量的线程(虚拟用户)重现这种情况,则意味着 MySQL 数据库是 bottleneck so you might want to tune MySQL instance for better performance or even test it separately by using JMeter's JDBC Request sampler