四月
23
2014

MySQL使用AWS SSD效能測試

AWS某些instance有提供SSD,下面是使用m3.medium,並且將MySQL安裝在SSD上面的測試數據

[root@ip-172-31-17-67 ssd]# time sysbench --test=oltp --mysql-table-engine=innodb --mysql-user=$dbUser --mysql-password=$dbPassword --db-driver=mysql --mysql-db=test --oltp-table-size=1000000 --oltp-table-name=t1 --oltp-nontrx-mode=insert --mysql-socket=/mnt/ssd/mysql/mysql.sock run
sysbench 0.4.12: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1

Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 10000
Threads started!
Done.

OLTP test statistics:
queries performed:
read: 140000
write: 50000
other: 20000
total: 210000
transactions: 10000 (169.49 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (3220.29 per sec.)
other operations: 20000 (338.98 per sec.)

Test execution summary:
total time: 59.0009s
total number of events: 10000
total time taken by event execution: 58.8980
per-request statistics:
min: 2.65ms
avg: 5.89ms
max: 111.90ms
approx. 95 percentile: 15.02ms

Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 58.8980/0.00

real 0m59.107s
user 0m4.027s
sys 0m9.246s
四月
20
2014

讓WordPress輸出的RSS支援特色圖片

現在大家常常使用feedly或者是flipboard來看網站的內容,而通常有圖片的內容會比較吸引大家進去看。雖然wordpress有提供特色圖片這個功能,但是在輸出rss的時候,卻沒有加入特色圖片的支援,造成在feedly或者是flipboard的顯示時都不會有圖片顯示。

要解決這個問題只需要安裝Featured Images in RSS w/ Size and Position這個plugin就可以解決,但是另外一個問題來了,安裝這個外掛之後,文章的內容會被加入一張wordpress的特色圖片小圖,造成內容裡面的圖片重覆,我個人是不太喜歡這樣的輸出,因此我在這個plugin加入了以下幾行程式,同時也有將這個功能提交給作者,或許有機會可以被加入這個外掛的功能中 (Remove default small image)

// 修改 wp-content/plugins/featured-images-for-rss-feeds/featured_images_in_rss.php這支程式
// 找到function featured_images_in_rss($content)這個function
// 在第42行下面,加入下面的程式
// remove default small image
$pattern = '/<div><img width="150"+.+div>/';
$replace = "";
$content = preg_replace($pattern, $replace, $content);
頁次:1234567...277»