压测接口报500后如何查看响应数据 这是哪里答性能瓶颈?
来源:1-8 性能测试需求分析
慕码人911261
2018-12-24
[1040]PDOExceptionin Connection.php line 300SQLSTATE[HY000] [1040] Too many connections
$this->fetchType = $config['result_type'];
} try { if (empty($config[‘dsn’])) { $config[‘dsn’] = KaTeX parse error: Expected 'EOF', got '&' at position 6: this-&̲gt;parseDsn(config); } if ($config[‘debug’]) { $startTime = microtime(true); } KaTeX parse error: Expected 'EOF', got '&' at position 6: this-&̲gt;links[linkNum] = new PDO($config[‘dsn’], $config[‘username’], $config[‘password’], params);if(params);="line−301">
if (params);</code></li><liclass="line−301"><code>if(config[‘debug’]) {// 记录数据库连接信息Log::record(’[ DB ] CONNECT:[ UseTime:’ . number_format(microtime(true) - $startTime, 6) . ‘s ] ’ . $config[‘dsn’], ‘sql’);}} catch (\PDOException KaTeX parse error: Expected '}', got 'EOF' at end of input: … if (autoConnection) {Log::record($e->getMessage(), ‘error’);return KaTeX parse error: Expected 'EOF', got '&' at position 6: this-&̲gt;connect(autoConnection, KaTeX parse error: Expected 'EOF', got '}' at position 66: … }̲ else {…%&*=YLMY*&%KaTeX parse error: Expected 'EOF', got '#' at position 1: #̲@!=">ylmy!@#%&*=YLMY*&…’, [0, 2, 0, …]) in Connection.php line 300
atConnection->connect() in Connection.php line 934
atConnection->initConnect(false) in Connection.php line 357
atConnection->query(‘SELECT * FROMtpn_g...', ['where_status' => [1, 1], 'where_type' => [1, 1], 'where_id' => [30, 1]], false, false) in Query.php line 225atQuery->query('SELECT * FROMtpn_g…’, [‘where_status’ => [1, 1], ‘where_type’ => [1, 1], ‘where_id’ => [30, 1]], false, false) in Query.php line 2453
atQuery->find([‘id’ => 30]) in Index.php line 394
atIndex->getcate()
atReflectionMethod->invokeArgs(object(Index), []) in App.php line 224
atApp::invokeMethod([object(Index), ‘getcate’], []) in App.php line 418
atApp::module([‘api’, ‘common’, ‘index’, …], [‘app_namespace’ => ‘app’, ‘app_debug’ => true, ‘app_trace’ => false, …], true) in App.php line 130
atApp::run() in start.php line 18
at require(’/www/wwwroot/yilingm…’) in index.php line 28
2回答
-
大周
2018-12-24
500的意思是服务扛不住了。 详见:http协议响应码。 瓶颈肯定就是在代码上了。 处理不过来了。 你少发一点看看,看看瓶颈是多少个线程。然后让开发再有针对性的去调一下。 在压的时候,注意看一下程序的日志。还有一点是你这个程序是php的代码,本身性能就不好,如果服务器硬件再不行的话,扛不住几个并发的。 所以不要一上来就压很多。 先10个或者20个跑一会看看。
112018-12-25 -
只为编程
2020-12-01
这个问题就是数据库连接的问题,创建的连接太多了,PDO是php实现数据库连接的一个类,试着让开发创建POD连接池,通过复用连接的方法,可以避免数据库连接过多的问题
00
相似问题