Raised This Month: $ Target: $400
 0% 

[TF2 Stats] With Web Ranking and Item Logger [v9.1.0]


Post New Thread Reply   
 
Thread Tools Display Modes
Sobuno
Member
Join Date: Aug 2009
Old 10-08-2012 , 20:02   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.0.0]
Reply With Quote #2331

Quote:
Originally Posted by DarthNinja View Post
The website should check and skip processing if the IP is 0 (invalid).
I've told galadril about this any number of times, but it's never been added.
I have no idea if this is still a problem for people, but here's a fix (At least for that particular instance of the problem; I have not searched through the files for other instances)

The attached player.txt should silently skip geolocation if the IP is invalid instead of raising an error as the current version does. Rename to player.php and upload.

That is the only thing that has been changed.


And wow, the player_ranking.php page is slow on Eraserhead's server (and probably any other large server). I'd wager a guess it has something to do with the page ordering by points without having an index of some sort on it. 23550 numbers having to be sorted every page-refresh is sloooow. I don't know what kind of performance hit the plugin would take if an index were added though, as I am guessing it updates rather often and thus would have to re-index on every update. Of course, there is the possibility of only pushing changes to the webinterface database every x minutes, but that would likely require quite a bit of rework.
Attached Files
File Type: txt player.txt (49.1 KB, 198 views)
Sobuno is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 10-09-2012 , 01:19   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2332

Thanks Sobuno
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
eraserhead
Veteran Member
Join Date: Nov 2009
Old 10-09-2012 , 06:09   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2333

Thanks, uploading your file now :-)

And yeah, it's pretty slow.
__________________
eraserhead is offline
Send a message via Skype™ to eraserhead
Sobuno
Member
Join Date: Aug 2009
Old 10-10-2012 , 20:34   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2334

Quote:
Originally Posted by eraserhead View Post
Thanks, uploading your file now :-)

And yeah, it's pretty slow.
Ok, I took a closer look at player_rankings.php and I believe I can improve its performance significantly.

The attached file should be renamed to player_ranking2.php and uploaded. If it seems to work properly, you can just rename it to player_ranking.php instead, replacing the default file.

As I haven't had a TF2 server for several years now, I have no way to test it, so it's at your own risk. I only promise I haven't added anything that will harm your data.


Technical explanation for possible improvement:

Every query to the database takes times - a lot of time when there are no indexes on the database table and the table is big. The page previously made a scan for the relevant players for the page. For each player, it would then have two additional queries, one fairly simple and another one which probably takes ages. This results in a total number of queries for the ranking at 1+1+2*players-per-page, which, on Eraserhead's server is 50 per default = 102 queries per page.

The simple query did not change per player search, so I moved it outside the loop, instead caching the results for each player. This brings us down to 52 queries (Although the ones we got rid of were lightweight, and depending on the DB settings, may already have been cached).

The heavy query for each player was calculating their ranking. The ranking in this plugin is done by checking the database for the number of players who has the same or a larger number of points as the player himself. This means a total table scan for every player since there are no indexes on points as discussed in my previous post. In order to combat this, one scan is now performed to get the rank of the first player on the page, and the rest of the players' offset are then calculated based on this information. An additional scan is performed to get the rank of the last player (As more players with the same number of points may be on the next page).

This means that we're down to a flat number of queries, namely 1+1+1+1+1 = 5 queries total, of which 3 are heavy. What this means is that worse performance will be had if the players-per-page is set at 1, resulting in 5 queries instead of 4 as before. In all other cases, the performance should be better. For the (what I assume is default) players-per-page at 50, this means about a 94% reduction in the number of "heavy" queries, which should bring about a vast performance increase for the player rankings page (Provided your database table is big like Eraserhead's)
Attached Files
File Type: txt player_ranking2.txt (11.4 KB, 129 views)

Last edited by Sobuno; 10-12-2012 at 07:13. Reason: Uploaded new version
Sobuno is offline
Sobuno
Member
Join Date: Aug 2009
Old 10-10-2012 , 20:38   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2335

And the same optimization can be made at Class Ranking, I want to know if it works on Player Ranking before I continue though. Also, sleep calls on me.

Last edited by Sobuno; 10-10-2012 at 20:39.
Sobuno is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 10-11-2012 , 01:06   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2336

Aaaaaaaaaaaand thanks again Sobuno
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
Sobuno
Member
Join Date: Aug 2009
Old 10-11-2012 , 04:41   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2337

Quote:
Originally Posted by Sillium View Post
Aaaaaaaaaaaand thanks again Sobuno
Is it running on your website now? I can't really tell because all your pages seem lightning fast and I didn't check your site before now

EDIT: I have an optimization ready for weapon ranks now, runs along the same principles as the previous optimization. As always, no idea if it works.
Attached Files
File Type: txt weapon_ranking2.txt (7.1 KB, 104 views)

Last edited by Sobuno; 10-12-2012 at 06:59.
Sobuno is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 10-11-2012 , 07:24   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2338

Yes I added it to our Stats site: http://tf2.unterwasserpyromanen.de

There is a problem with the Weapon Ranking page. There are no kills shown for the weapons and if you select a weapon there are no ranks shown:
Your version:
http://tf2.unterwasserpyromanen.de/w...tier%20Justice
old version:
http://tf2.unterwasserpyromanen.de/w...tier%20Justice


It's probably fast because we have less players in our stats
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
Sobuno
Member
Join Date: Aug 2009
Old 10-11-2012 , 08:47   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2339

Quote:
Originally Posted by Sillium View Post
Yes I added it to our Stats site: http://tf2.unterwasserpyromanen.de

There is a problem with the Weapon Ranking page. There are no kills shown for the weapons and if you select a weapon there are no ranks shown:
Your version:
http://tf2.unterwasserpyromanen.de/w...tier%20Justice
old version:
http://tf2.unterwasserpyromanen.de/w...tier%20Justice


It's probably fast because we have less players in our stats
I've uploaded a new version that should fix these problems; it was just a case of a lowercase W versus an uppercase
Sobuno is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 10-12-2012 , 01:17   Re: [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #2340

yeah.. looks better now...but take a look at both versions. In your new version the last 2 Ranks are occupied by the same player. Rank 19 is missing but rank 20 is shown twice
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode