by vbernetr » Fri Jul 17, 2009 2:59 pm
Hi.
Not sure exactly how much data you are storing, nor how exactly phpLogCon works (does it get logs from MySQL or flat files ? or both ?).
Basically, storing logs in a DB is great for low volumes.
Things you want to consider are the following :
- are the columns you are searching indexed ?
- can the entire index hold in ram ? Try tweaking MySQL.
The performance bottleneck when handling logs will (almost) always be IO. Be it IO from reading the MySQL table, or IO from reading files. This explains the 10% CPU use. If you have indexes, and MySQL uses those indexes, it should be slightly faster than files. However, reading files will almost always be faster than a full mysql table scan (Table scans will happen when there is no index, the index can't be used, etc. Any query containing 'LIKE' will cause a table scan.).
A great way to limit this IO bottleneck is compression. Log data compresses tenfolds with gzip, and reads will be 5 to 10 times faster. Using tools like zgrep make your life easy afterwards. Bzip2 compresses better, but is way too slow.