I have just upgrade my site from drupal 5.17 to drupal 6.11 and upgrade User Stats from 5.x-1.0-beta4 to 6.x-1.0-rc1
Forum topic loading about 20-30 seconds
I have core quad for one site, and site is offline
I have 1300000+ comments and 150000+ nodes and devel show me next:
Executed 354 queries in 27519.63 milliseconds
4 top slow Queries maded by User stats:
6872.76 ms - user_stats_post_count_update - SELECT COUNT(*) FROM comments c INNER JOIN node n ON c.nid = n.nid WHERE c.uid = 22486 AND c.status = 0 AND n.status = 1 AND n.type IN ('blog','poll','forum','bio','game','konkurs','photolist','photolist_man','story')
6866.51 ms - user_stats_post_count_update - SELECT COUNT(*) FROM comments c INNER JOIN node n ON c.nid = n.nid WHERE c.uid = 15047 AND c.status = 0 AND n.status = 1 AND n.type IN ('blog','poll','forum','bio','game','konkurs','photolist','photolist_man','story')
etc..
I dont have this problem in drupal 5 and User Stats 5.x
Comments
Comment #1
liam mcdermott commentedThis is a difficult one. But I am very willing to optimise User Stats for larger sites. Here are some questions and things to consider:
SELECT COUNT(*) ...again. Basically, when the post counts for every user are stored, you shouldn't see this problem again.SELECT COUNT(cid) ...instead ofSELECT COUNT(*) ..., this might be faster, in many cases, since the database could use the key cache already held in memory, instead of doing a table scan, it might be conceptually incorrect though, since we're counting the number of rows, not values of cid (see: http://www.mysqlperformanceblog.com/2008/09/20/a-common-problem-when-opt... and http://www.mysqlperformanceblog.com/2007/04/10/count-vs-countcol/);Comment #2
liam mcdermott commentedComment #3
off commented1. Yes! Load the thread a second time going fast, but first time very.. very slow.. I dont understand what changed in module from 5.x that lead this slow effect.
when the post counts for every user are stored, you shouldn't see this problem again
Good news.. i tried
Comment #4
off commented2. I set cron run every minute.. Where I can see how much users left to be counted?
Comment #5
off commented3. How about User titles (http://drupal.org/project/user_titles)?
I dont have a problem with this module and them coun posts to..
For a long time I ask a question. Whether it is impossible to unite somehow efforts of these two modules for calculation of quantity of posts.
And how User titles does this?
How can I do check the query is using indexes?
Comment #6
off commented4. Probably, but when I have started to use User stats I have already many of visitors on a site, but had no powerful server and did not see a difference in productivity of a site with the included module and with switched off.
Now the topic is loading less than for a second with the switched off module and more than 20 seconds with the included.
Comment #7
liam mcdermott commentedThis is enough information for me to investigate, thanks.
I've done some testing and the query is about as fast as it can be, although it might be sped up by an extra index on nid, uid, status on the {comment} table. The problem is that messing around with core tables is a no-no (as some other module may come along and try to make similar changes, leading to incompatibilities), so I'm going to have to think of another way around the problem.
Literally nothing has changed in the way posts are counted, check the queries, they are exactly the same. Not saying you're wrong, just that I don't know either.
Currently there's nothing in the admin interface which shows how many users there are to be counted. I probably won't add such a feature for some time (unless someone pays me to do so).
Here's a query that will tell you roughly how many people are left to count:
select (select count(*) from users)-(select count(distinct uid) from user_stats_values);(Note: you'll need to add any table prefixes, and this doesn't take into account people who've been banned and whatnot)
I will check User Titles, thanks. :)
Am not holding out much hope though, I expect User Titles counts posts during cron, or when a new post is inserted. The key problem here is User Stats needs to show post counts in forum threads, on-demand, User Titles can do everything behind the scenes. :)
I'm not sure I understand this. Are forum topics loading slowly, even after the post count has been stored? This is quite important, as I may need to improve the performance of other parts of User Stats!
Comment #8
off commentedThanks for help!
I use User stats and my site running fast, but i remove
<?php print user_stats_get_stats('post_count', $node->uid); ?>from any comments and put this on profile page.
I will watch for the development of the module.
Thanks for work!
Comment #9
soelver commentedI think I have the same problem. I crash the site every time I try to load IP or other userstat information.
Not sure what to do about it, but will ask a more technical friend, to read up on this issue - I'm sure he'll understand better than me.
We have our own dedicated server, and everything else usually runs smoothly, but this module seems to have some loading issues.
Using same version as described here.
Comment #10
off commentedOn my site at the moment good performance