Tuning WordPress Plugin – Visitor Maps and Who’s Online

I think this is one of the top 10 wordpress plugin that a lot of people using now – Visitor Maps and Who’s Online.

You can download in here

If you have a lot of visitor visit your blog / website that using this plugin, this plugin may slow down your MySQL.
MySQL will show that some query that SELECT from wp_visitor_maps_wo is not using indexes.

For more information about How MySQL Uses Indexes click here.

Here is the way to trace out that your query is not using index.


# vi /etc/my.cnf
slow_query_log=1
log_slow_queries = /var/log/mysql/log-slow-queries.log
long_query_time = 10
log-queries-not-using-indexes
# service mysqld restart


Try to load your wordpress site with Visitor Maps and Who’s Online plugin installed and activated.

Then

# tail /var/log/mysql/log-slow-queries.log

You may see this code. This may slow down your MySQL performance.

SELECT count(*) FR0M wp_visitor_maps_wo
WHERE (name = 'Guest' AND time_last_click > '1284278942')
0R (user_id > '0' AND time_last_click > '1284278942');

Because we know that SELECT count(*) always use up a lot of MySQL resources.

So, we should add index to the table field.


# mysql -u -p
mysql > alter table wp_visitor_maps_wo add index(time_last_click);

or you can add the INDEX using phpMyAdmin to the field time_last_click in table wp_visitor_maps_wo

After this, try to reload your website for few times, and check the /var/log/mysql/log-slow-queries.log appear the SQL again or not. Remember to turn off the slow_query_log from slow_query_log=1 to slow_query_log=0 after the tuning.


Tags: , , , , , ,
  • Thanks man,
    today i found that i had the same problem. had a simple ddos, about 100 ip executed to this plugin.

    Created this index.

Translate

Buy me a Caffè Latte

Thank you for the Caffè Latte

2013/02/15 saw art
2013/01/25 Parul Patel
2012/11/20 Barbara Nicholas $10
2012/10/08 Amy Stockman $5
2012/07/15 siewho chang $ 50
2012/06/08 Susan Hampton $10
2012/05/11 Chris Grima $10