MYSQL basic tuning

As http://lens.treetwo.com traffic shows a nice growth, performance issues arise. You have 2 friends to do basic tuning of MYSQL, named:

1. MYSQL slow-query-log
to find out which SQL is slow
http://blog.longwin.com.tw/2005/10/mysql_query_slow_find/
http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html

2. EXPLAIN query
to find if a slow query had been improved
http://dev.mysql.com/doc/refman/5.0/en/explain.html

+—-+—————+——-+——–+——————-+—–+———–+——+——-+——–+
| id    | select_type | table  | type    | possible_keys   | key | key_len  | ref     | rows   | Extra  |
+—-+—————+——-+——–+——————-+—–+———–+——+——-+——–+
先留意 Extra 唔應該出現 filesort 或 tempery, key 也不應該 NULL, 詳細的 tuning 請服用 http://www.databasejournal.com/features/mysql/article.php/1382791/Optimizing-MySQL-Queries-and-Indexes.htm

Bookmark and Share
Leave the first comment

Hobby project: 鏡頭搜尋器

http://lens.treetwo.com

Used CI2.0 as a test

Bookmark and Share
Leave the first comment

Config if using VPS and mpm_prefork_module

You can estimate the number of MaxClients your system will support by taking the amount of memory and dividing it by what you expect each apache process will need. If you have 512MB of memory and you believe apache will need 20MB per process, 512/20 = 25.6. You need to consider the fact that other programs will need memory too. If you have Apache and MySQL running on the same box, do you think MySQL processes will stay the same when Apache gets busy? More likely, they will both eat up resources during peak hours. If you leave MySQL with half the available memory, raising MaxClients to 12 should be a safe decision. You’re better off erring on the side of caution. You can always raise the number later.

Bookmark and Share
Leave the first comment

有點慢了, codeigniter 2.0 release

http://codeigniter.com/news/codeigniter_2.0.0_released/

比較重要的是版本上的改變. CI2.0 以後會有兩種版本, core 和 reactor. Reactor 會更快的更新, 將會加入更多社區的開發者, 令 CI 的發展入更多的社區元素, 發展更快. 接下來就看看 CI 社區如何回應, 和實際可參與的程度有多高了.

Bookmark and Share
Leave the first comment

Codeigniter: Use another views folder 使用另一個 views 資料夾

$this->load->view() 系統 default 使用 system/application/views 內的檔案, 但其實是可以指定另一個資料夾, 以簡單的逹成 “admin 使用另一個theme” 的要求:

$this->load->view() on called, CI will use the views files in ‘system/application/views’. But actually, you can specify one for the requirement like “Admin should use another theme”.

在 system/application/libraries 建立一個 MY_Loader.php:

in system/application/libraries create a file MY_Loader.php:

class MY_Loader extends CI_Loader {
  function MY_Loader() {
    parent::CI_Loader();
    $this->_ci_view_path = APPPATH.'views/';
  }
}

其中, MY_ 是 config.php 內的 subclass_prefix 定義的, 都可以自行修改.
MY_ is a prefix defined in config.php named as ‘subclass_prefix’. Edit for your ease.

Bookmark and Share
Leave the first comment

介紹一個 TDD (Test driven development) 的 demo

http://sites.google.com/site/tddproblems/all-problems-1/Bowling-game

其實還有 pair programming, 用 transcript 的形式表現, 效果很好, 誠意推介

Bookmark and Share
Leave the first comment

Netbeans on PHP cannot create patch sucks

CVS support is minimum, as well as SVN, and Git…

Bookmark and Share
Leave the first comment

Tags: , , , , ,

MongoDB driver for codeigniter

MongoDB driver for codeigniter

http://bitbucket.org/alexbilbie/codeigniter-mongo-library/wiki/Home

Actually a wrapper for MongoDB PHP class, but still far better than nothing.

Need to find some time to test it out…

Bookmark and Share
Leave the first comment

Codeigniter migration tool code in github

https://github.com/treetwo/codeigniter-migration

related:

(中) http://treetwo.com/2010/09/20/%e4%b8%ad%e8%ad%af-db-migrate-in-codeigniter/

(ENG) http://treetwo.com/2010/09/06/db-migrate-in-codeigniter/

Bookmark and Share
Leave the first comment

rainbow circle demo on jsdo.it

jsdo.it is an social coding site that focus on html css and js

The most useful function is provide live preview to the code so static html project like rainbow circle can be demoed with code and preview

Checkout http://jsdo.it/treetwo/rainbow-circle !

Bookmark and Share
Leave the first comment