回應:
回應:
you have to rewrite the php forum such that it uses mysql_connect() (NOT mysql_pconnect()) and retains some of the mysql connection threads on the server side.
最主要的原因是 table lock .
是先因為 table lock 才會導致 too many connections 的
所以,即使加上 connection pool 也無濟於事
(否則本站最多線上四百多人,大家都在 reading , 網站速度仍然飛快...)
而 table lock 的主因: 硬碟不夠快、不是 SCSI 硬碟、資料庫不是獨立主機 ...
我覺得 Connection Pooling 是有正面效應的。Database Connection 本就 expensive, 會用到 CPU 的不少資源﹐也影響 MySQL 的速度。試想每一 Connection 省一秒﹐每天有多少個 Connection? 省下來的時間可讓 MySQL 處理其它 request, 良性循環﹐現在可是惡性循環啊~~
您提到 Table Lock, 我假定您是用 MyISAM Table Type (supports Table Level Locking). 如確實如此﹐而您的 MySQL 版本又 supports InnoDB 的話﹐我建議您換去 InnoDB Table Type (supports Row Level Locking), 那麼﹐ Insert/Update/Delete 就不需要 Lock 整個 Table 了。
我覺得硬件倒不是最主要的原因﹐因為 PHP Web Application 及 Database Design 還有很多待改善的空間﹐MySQL Performance Tuning 也會有明顯的幫助。
_________________________
命運可改變﹐先問您意願。旁人幫不了﹐命運在您手。
有病方為貴﹐無煞不成奇。逆境要求存﹐強者得永生。