因為被slow query 搞的很煩….網站速度一直起不來
因為Database 設計上的問題…..(幾個比較常用的Table 大蓋都差不多有70萬個Record )
且因為我Table Engine 是 MyISAM
用Rep 的話….若是crash 要修…好像很麻煩…
所以變成要用Rep 的話最好能先轉成InnoDB
不過因為我Slow Query 很多…若是我Rep Master Lock 的話
Slave 也會卡住…..
也不是完全的解決了Slow Query這問題….
所以我想最完美的解法可能是
Rep + Aging…
不過要花不少時間來整個改……
當前沒這麼多時間讓我來用這些…
所以我目前的解法是…
加Ram 然後把MySQL 的Ram 讓他吃愈多愈好…
Ref
MYSQL優化詳細介紹!
7.5.2. Tuning Server Parameters
Section 5.1.3, “System Variables”
Section 5.1.5, “Status Variables”.
結論就是RAM 有多少吃多少…
讓MySQL可以用的Ram 愈多愈好就沒錯了…
PS
FreeBSD 因為單一Process 預設只能吃到512MB 的Ram
所以在/boot/loader.conf 也要調一下
FreeBSD limits the size of a process to 512MB, even if you have much more RAM available on the system. So you may get an error such as this:
Out of memory (Needed 16391 bytes)
In current versions of FreeBSD (at least 4.x and greater), you may increase this limit by adding the following entries to the /boot/loader.conf file and rebooting the machine (these are not settings that can be changed at run time with the sysctl command):
kern.maxdsiz=”1073741824″ # 1GB
kern.dfldsiz=”1073741824″ # 1GB
kern.maxssiz=”134217728″ # 128MB
For older versions of FreeBSD, you must recompile your kernel to change the maximum data segment size for a process. In this case, you should look at the MAXDSIZ option in the LINT config file for more information.
注意一下…調到超過2G 要注意一下..
我調到4G 有發生慘事….
刻在另一篇..