Regular visitors to this site will have noticed that this blog and others on the server take an inordinate amount of time to display sometimes. Basically, this machine is unfortunately under-powered but we’re working on making the best of use of the available hardware with some changes to MySQL and Apache and to b2++ too. Here’s what I did this morning:
- Referers are checked and only if requests go to either “/”, “index.php” or “archive/” are they recorded.
- Referers are now recorded using INSERT DELAYED.
- I added keys on the post_date and post_category fields in *posts tables. The main SELECT is now a “range” instead of “all” request.
Here’s a short bash script you can use to update your db. Remember to change “username” and “password” to suit your own setup.
for i in `echo show tables | mysql -u username -ppassword b2|grep posts`; do echo "ALTER TABLE \`$i\` ADD INDEX ( \`post_category\` )"| mysql -u username -ppassword b2; echo "ALTER TABLE \`$i\` ADD INDEX ( \`post_date\` )"| mysql -u username -ppassword b2; done
Useful links: Mysql Optimization | Optimizing MySQL: Hardware and the Mysqld Variables (mentioned previously) | MySQL Optimisation and a few other pages.
You might also like