View Single Post
Jaykrog
Senior Member
Join Date: May 2015
Old 12-13-2015 , 13:19   Re: [CS:GO] ckSurf (1.18b, 24.11.2015)
Reply With Quote #905

Nice updates joni.

Thought I'd share some feedback after going through some of the point calculation code.

While I think there's obviously room for improvement on the efficiency of the point calculation process due to the number of SQL queries that need to be made, I think these might be some quick wins:
  • dont query for challenges if challenge points are disabled - though, this will probably cause the pointsratio and winratio to not be reported in your current query (easily fixable if you do some checking).
  • modify challenge query so you only pull where bet > 0
  • change number of players that beat the bonus to a count query
  • sql_selectPersonalAllRecords serves no real purpose (joins are getting unnecessary data), can get the same data without unnecessary joins from sql_CountFinishedMaps - data can be sent down via packets to next call
  • sql_selectPlayerRankProTime change to a count query
  • sql_selectPlayerProCount serves no real purpose, player time on map can be passed down from sql_CountFinishedMaps via packets
  • sql_selectPlayerProCount change to a count query

I picked these up while recreating the logic that's being executed to calculate points in a C# program, so that I could understand it better. While they are small enhancements, when you multiply those small enhancements by how many times they are being performed in large servers with lots of maps and good players, they start to add up.

I refreshed the points of my entire ranked player base (8,743 players that have actually beaten a map) using this program. While doing so, I tracked the number of queries that I had to run to accomplish this... turns out it was a whopping 112,960 queries. This means on average, every time someone beats a map, the server is doing roughly 13 queries to the database to recalculate their points. The #1 ranked player on the server had to perform 351 queries (he'd beaten roughly 141 maps).

Somehow we've got to make this more efficient, though I realize this is a lot of work and can't think of a good solution for doing so. However, it would probably solve a lot of the problems that are being reported (points not being received after beating a map, etc).

Also, for those who are wondering why refreshing all ranks is not available, or why the rank calculation is throttled to a # of ranks... this should give you a pretty good indication. It took probably an hour to get through all of these queries (single threaded).

Last edited by Jaykrog; 12-13-2015 at 13:27.
Jaykrog is offline