小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

為什么你的pgbouncer連接這么慢

 丹楓無跡 2022-02-14

在PostgreSQL中;說得連接池,立馬想到pgbouncer。pgbouncer 的目標(biāo)是降低因?yàn)樾陆ǖ?PostgreSQL/Greenplum 的連接而導(dǎo)致的性能損失。

在項(xiàng)目中;DBA會(huì)勸開發(fā)人員使用連接池。這樣可以控制連接數(shù)。也避免反復(fù)建立連接帶來的性能消耗。對(duì)連接池的優(yōu)點(diǎn)。這篇文章講解比較好。

但是在開發(fā)人員在使用連接池的過程中,一般開發(fā)人員那邊也有自己的jdbc的連接池。在啟動(dòng)項(xiàng)目的過程;于是出現(xiàn)下面這段對(duì)話

開發(fā)人員:這項(xiàng)目啟動(dòng)好慢;原因是連接數(shù)據(jù)庫好慢。

DBA:這項(xiàng)目啟動(dòng)時(shí)申請(qǐng)多少數(shù)據(jù)庫連接。

開發(fā)人員:沒多少;也就50。峰值不會(huì)超過400。

DBA:直連數(shù)據(jù)庫會(huì)慢嗎?

開發(fā)人員:不會(huì),啟動(dòng)很快。

連接池pgbouncer是一個(gè)針對(duì)PostgreSQL數(shù)據(jù)庫的輕量級(jí)連接池。但是單線程的。我觀察在啟動(dòng)的過程中;連接數(shù)是一條一條增加的。并不是你需要多少就給多少

[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
44
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
45
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
46
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
47
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
47
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
49
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
49
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
49
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
49
[postgres@bogon pgbouncer]$ ps -ef | grep postgres | grep 127 |wc -l
50

若是這樣的話;那我們知道為什么項(xiàng)目通過pgbouncer啟動(dòng)很慢了。
若我們提前申請(qǐng)一批連接資源做為idle。等項(xiàng)目啟動(dòng)的時(shí)候直接可以用不久解決了,說干就干。

在pgbouncer的配置文件中設(shè)置

min_pool_size = 50

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多