Optimizing Statpress

Statpress is a plugin for tracking real-time traffic. Currently, its update is a little slow (or completely stopped), which has caused some revamps as StatPress Dashboard Widget Lite , StatPress Reloaded , StatpressCN , StatPress SEOlution and some other versions in development.
The good, the bad, the ugly (?)
I will talk about Statpress , the original version. The information provided by this plugin is very wide and gives a detailed measure of site traffic. It has detailed information from the visitor, its location , pages visited, operating system and browser used. Also it shows what were the latest returns searches, etc. etc. etc. etc. etc. In short, provides precise indicators for every day use.
To summarize: I recommend it. In future posts I will come back to him and also Google Analytics and other statistics plugins.
Heavyweight: data and indexing bots
All the detailed information provided by the plugin is based on a heavy table wp_statpress . This is the nerve center of the plugin and where it stores all the information to compile statistics.
Each site visit is recorded in this table and this is itself the Achilles heel of the system. In a regular site this table growth is alarming. If the site is indexed correctly, the indexing agents (spiders) enter many times a day to the site to index the content. The spider info is (optionally) recorded.
Y have live example: a site with about 400 unique visitors daily, whose content is updated daily, the income of spiders was as many as 1000 visitors a day. After a period of with daily content updates (a site which is added about one to 5 posts per day) (period= aprox. 6 months) the number of spiders surged to more than 10,000 bots per day and raising (but the visitors were slowly increasing to 500). A one record per visit, the base grew over 10,000 rows daily. Unless you are interested in statistics about spiders, it is preferable to avoid registering Statpress agents to save space.
- Tip 1: If the site begins to have ‘critical mass’ of visitors (> 300 would be an acceptable value), disable the spider statistics.
Now suppose that the spider are disabled. Fast forward to the future in the same site and think we have a site a little more traffic (+1000) unique visitors daily. This implies that at least we have 1000 records per day (in a worst case scenario).
According to the tests I made, after 150,000 - 200,000 records (5-7 or less), the statistical calculation done by the plugin could be seriously compromised by delaying more than reasonable.
- Tip 2: If possible, index the tables.
This script is valid for Statpress plugin:
alter table wp_statpress modify column date int(8) NULL NULL, modify column time time NULL NULL, modify column ip varchar(15) NULL NULL, modify column nation varchar(10) NULL NULL, modify column os varchar(64) NULL NULL, modify column browser varchar(64) NULL NULL, modify column searchengine varchar(64) NULL NULL, modify column spider varchar(64) NULL NULL, modify column feed varchar(32) NULL NULL, modify column user varchar(64) NULL NULL, modify column timestamp timestamp NULL NULL, add index spider_nation (spider, nation), add index ip_date (ip, date), add index (agent(255)), add index (search(255)), add index (referrer(255)), add index feed_spider_os (feed, spider, os), add index (os), add index date_feed_spider (date, feed, spider), add index feed_spider_browser (feed, spider, browser), add index (browser);
Source: Improve the performance of the WordPress plugin Statpress (and your blog)
- Tip 3: unless you want to keep the data for historical reasons, clear the data after an acceptable period (3 months or whatever is decided depending on traffic). You can set this in the options page.
Improvements after applying the changes to the table. (Sample of approximately 200,000 records.)
View Gráphic (only last 7 days) 39 seconds -> 17 seconds (x2, 3 faster)
View Details 47 seconds -> 8 seconds (x5, 9 faster)
Spy 56 seconds -> 9 seconds (x6, 2 fast)
So the optimization is worthwhile.
The last thing I did was download the latest version of Statpress and make these changes.
This link it is a modified version with indexing options. Is in BETA, download at your own risk.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.

admin


