2008年10月18日
MovableTypeの迷惑コメント・迷惑pingを削除してMySQLを整理整頓
迷惑コメント、迷惑ping(迷惑トラックバック)を受け続けているとMovableTypeのデータベースは肥大化する。このため、時々はMySQLデータベースの整理整頓を行ってやろう。データベース容量を抑え、ひいてはMovableTypeの動作軽量化にも繋がる。もちろん、SQLiteやPostgreSQLでもデータベースの整理整頓は大切だ。
MovableTypeは世界中に普及しているおかげで、当然スパムの攻撃対象にもなる。このブログの場合は迷惑コメントが月に約2500件、迷惑トラックバックが月に1000件来る。毎月数件は残念ながらフィルターをすり抜けてブログに表示されてしまうが、99.9%程度はMovableTypeのスパムフィルター(SpamLookupプラグイン、BanASCIIプラグイン)で排除しているのでブログには表示されない。BanASCIIプラグインは英数字しか含まないスパムを判定するフィルターで、これで海外からの大抵のスパムを排除できる。SpamLookupプラグインでブラックリストの参照先を登録しておくとこのブラックリストに掲載されているIPからの投稿をスパムと判定できる(アドレスチェックに「bsb.spamlookup.net, niku.2ch.net,」、ドメインチェックに「bsb.spamlookup.net, sc.surbl.org, rbl.bulkfeeds.jp」などを登録しておくと良い)。
これでスパムは迷惑フォルダーに放り込まれるし、迷惑フォルダーはワンクリックで中身を空に出来るのだが、中身を空にしたところでMovableTypeのコンソールパネルで表示されないだけでMySQL内にはデータとして保存されている(phpMyAdminで確認できる)。これは、「データ領域の解放操作は、レコードの削除のたびに実施するには重すぎる処理で、再利用した方が大抵の場合都合が良い。そのため1度使われたデータ領域は解放されずに再利用の為に保持される。」ということと「データレコードの再編成、削除などを繰り返し行うと、データベース内に無駄な未使用領域ができる(オーバーヘッド)」というデータベースの仕様によるものである。
そこで、MovableTypeの迷惑コメント、迷惑pingをコンソールパネルで「空にする」で削除してみてから、phpMyAdminにログインしてみよう。オーバーヘッド領域に何MBのデータ領域が使われているかを確認することが出来る(図のオレンジ枠部分)。特に、mt_commentとmt_tbpingのオーバーヘッド領域は過去に削除されたスパムがため込まれている部分だ(図の紫枠部分)。オーバーヘッド領域を無くし最適化するために、最適化したいものにチェックを入れて、「チェックしたものを」の「テーブルを最適化する」を選択しよう(図の緑枠部分)。おそらく数秒も待たずにオーバーヘッド領域が無くなり、同時にデータベースの容量も小さくなることだろう。MovableTypeのログも不必要であれば削除しても動作には問題ない。
ちなみにこのMovableType 3.37では2004年MovableType 2.661からの4年間の運用のうちにデータベースの容量は肥大を続け、2008年9月のSQLiteのサイズは31MB。これをMySQLに変更したところ17MBまで減少したが、さらに貯まりに貯まっていた数万件のスパムをMovableTypeの迷惑コメントフォルダから一括削除したところ7.5MBまで容量を圧縮。さらにさらに、オーバーヘッド領域の最適化を行って容量は5.8MBまでに抑えることが出来た。
Posted at 2008/10/18(土曜日)19:08
コメント
投稿者 zadoœæuczynienie : 2011年01月26日 08:46
You should take part in a contest for one of the best blogs on the web. I will recommend this site!
投稿者 diabeł boruta : 2011年01月26日 08:50
Pretty good article. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon.
投稿者 Zaehnebleichen : 2011年01月27日 01:08
I’d want to thank you for the efforts you have created written this post.
投稿者 External Hard Drive : 2011年01月27日 07:07
hello there and thank you for your info – I’ve certainly picked up something new from right here. I did however expertise several technical issues using this web site, since I experienced to reload the website a lot of times previous to I could get it to load properly. I had been wondering if your web host is OK? Not that I am complaining, but slow loading instances times will very frequently affect your placement in google and could damage your high quality score if advertising and marketing with Adwords. Well I am adding this RSS to my email and could look out for a lot more of your respective intriguing content. Ensure that you update this again soon..
投稿者 Brazilian Jiu Jitsu Tournaments : 2011年01月28日 06:03
I’d have to check with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!
投稿者 hair extensions san diego : 2011年01月28日 12:07
I discovered your blog site on google and check a few of your early posts. Continue to keep up the very good operate. I just additional up your RSS feed to my MSN News Reader. Seeking forward to reading more from you later on!…
投稿者 Oral B Pulsonic Slim : 2011年01月30日 00:50
Thanks for the useful information! My partner and i wouldn’t have found this on my own!
投稿者 cellulite removal : 2011年01月30日 20:52
Have a excellent day!. I feel like I’m always looking for interesting things to read about a variety of niches, but I manage to include your blog among my reads every day because you have honest entries that I look forward to. Here’s hoping there’s a lot more great material coming! cellulite treatment
投稿者 seotons : 2011年01月31日 03:09
I found your entry interesting do I’ve added a Trackback to it on my weblog and my seotons :)……
投稿者 wos : 2011年02月01日 01:11
What i do not realize is actually how you're not actually much more well-liked than you may be right now. You are very intelligent. You realize thus considerably relating to this subject, produced me personally consider it from a lot of varied angles. wos Its like men and women aren't fascinated unless it’s one thing to accomplish with Lady gaga! Your own stuffs nice. Always maintain it up!
投稿者 Meble dębowe : 2011年02月01日 18:04
This is really interesting, You are a very skilled blogger. I've joined your rss feed and look forward to seeking more of your wonderful post. meble drewniane Also, I have shared your web site in my social networks!
投稿者 Banners : 2011年02月01日 21:35
What’s Happening i'm new to this, I stumbled upon this I have found It positively helpful and it has aided me out loads. Overnight banners I hope to contribute & help other users like its helped me. Good job.
投稿者 Cellulite Treatment : 2011年02月02日 05:01
Have a fantastic day!. Thought I would comment and say cool theme, did you code it for yourself? It’s really really good! Cellulite Treatment
投稿者 hgh supplements : 2011年02月03日 18:42
Have a good day!. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me. hgh supplements
投稿者 Dress Up Games : 2011年02月04日 03:25
Have a good day!. Do you mind if I quote you on my blog if I link back to your website? Dress Up Games
投稿者 cheap web host : 2011年02月04日 09:42
Just a fast hello and also to thank you for discussing your ideas on this page. I wound up in your blog right after researching physical fitness connected issues on Yahoo… guess I lost track of what I had been performing! Anyway I’ll be back as soon as again within the potential to examine out your blogposts down the road. Thanks!
投稿者 Vinita Varvel : 2011年02月05日 05:47
Hey There. I found your blog using msn. This is a really well written article. I will be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll certainly return.
投稿者 Rahaa nopeasti : 2011年02月05日 09:22
This was a genuinely extremely excellent post. In theory I’d prefer to publish like this also - getting time and actual effort to make a great piece of writing… but what can I say… I procrastinate alot and by no means appear to obtain a little something done.
投稿者 Extended Stay Hotels San Diego : 2011年02月05日 21:28
Hi, i think that i saw you visited my site thus i came to “return the favor”.I am attempting to find things to enhance my site!I suppose its ok to use some of your ideas!!
投稿者 modified cars : 2011年02月07日 23:23
After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.
投稿者 Colon Cleanse : 2011年02月08日 12:07
Have a fantastic day!. I have read a few of the articles on your website now, and I really like your style of blogging. I added it to my favorites blog site list and will be checking back soon. Please check out my site as well and let me know what you think. Colon Cleansing
投稿者 Latest News : 2011年02月08日 14:15
This is the right blog for anyone who wants to find out about this topic. You realize so much its almost hard to argue with you (not that I actually would want…HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just great!
投稿者 children health : 2011年02月10日 13:06
i want to subscribe to your site,please tell me how?
投稿者 quit smoking aids : 2011年02月10日 13:14
Have a good day!. There are some interesting points in that clause but I don’t know if I see all of them middle to center . There is some validity but I will take hold opinion until I look into it further. Good clause, thanks and we want more! Added to FeedBurner too. quit smoking aids
トラックバック
このエントリーのトラックバックURL:
