Tuning MySQL ..

因為被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 讓他吃愈多愈好…

7.5.2. Tuning Server Parameters

Section 5.1.3, “System Variables”

5.1.2. Command Options

Section 5.1.5, “Status Variables”.

5.2.4. The Slow Query Log

結論就是RAM 有多少吃多少…
讓MySQL可以用的Ram 愈多愈好就沒錯了…

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 有發生慘事….


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料