日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

node mysql limit_node中mysql连接池的connectionLimit指什么,它和mysql的最小连接数和最大连接数的关系是什么?...

發(fā)布時間:2024/10/8 数据库 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 node mysql limit_node中mysql连接池的connectionLimit指什么,它和mysql的最小连接数和最大连接数的关系是什么?... 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

問題1:node中mysql連接池的connectionLimit指什么,它和mysql的最小連接數(shù)和最大連接數(shù)的關(guān)系是什么

問題2:mysql max_connections是什么,max_used_connections是什么,兩者的關(guān)系?為啥max_connecitons可以小于max_used_connections?

問題3:mysql pool.on('connection',callback)在什么情況下觸發(fā)?例如我的這段代碼,什么時候觸發(fā)connection事件?

var mysql = require('mysql');

var http = require('http');

var pool = mysql.createPool({

host : 'localhost',

user : 'guest',

password : '****',

database : 'test',

connectionLimit: 2

});

pool.on('acquire', function(connection){

console.log('connection %d accuired', connection.threadId);

});

pool.on('connection', function (connection) {

connection.query('SET SESSION auto_increment_increment=1')

});

pool.on('enqueue', function () {

console.log('Waiting for available connection slot');

});

// pool.end(function (err) {

// console.log('end!')

// });

http.createServer(function(req,res){

if(req.url==='/url1') {

pool.getConnection(function(err, connection) {

connection.query('select * from teacher', function(error,results,fields) {

if (error) throw error;

res.end(JSON.stringify(results));

// connection.release();

});

})

}

if(req.url==='/url2') {

pool.getConnection(function(err, connection) {

connection.query('select * from student', function(error,results,fields) {

if (error) throw error;

res.end(JSON.stringify(results));

connection.release();

});

})

}

}).listen(8001);

與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的node mysql limit_node中mysql连接池的connectionLimit指什么,它和mysql的最小连接数和最大连接数的关系是什么?...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。