每一MySQL伺服器在my.cnf設定檔中有一參數 max_connections

此參數用來控制MySQL所允許使用者的最大數量,MySQL 5.5此時的預設值是151(假如你沒有特別去設定)

而MySQL因為怕連線數灌爆,連管理者也無法連入進行維護,所以偷偷的留了一個連線給superuser,所以不要每個使用者都有superuser的權限喔^^

那max_connections的數值應該設多少才好呢??

以下是MySQL的回答,結果是因人而異,調調看吧

The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform, the amount of RAM available, how much RAM is used for each connection, the workload from each connection, and the desired response time. Linux or Solaris should be able to support at 500 to 1000 simultaneous connections routinely and as many as 10,000 connections if you have many gigabytes of RAM available and the workload from each is low or the response time target undemanding. Windows is limited to (open tables × 2 + open connections) < 2048 due to the Posix compatibility layer used on that platform.

Increasing open-files-limit may be necessary. Also see Section 2.5, “Installing MySQL on Linux”, for how to raise the operating system limit on how many handles can be used by MySQL.

 

arrow
arrow
    全站熱搜

    痞客興 發表在 痞客邦 留言(0) 人氣()