I know anytime there are tech issues with something you depend on, it is frustrating to say the least. I am deeply sorry for the issues that took place today and last week. While I cannot go back and correct the past, I am very happy to report that the issue is 100% fixed. You will notice now when you open the NBA lineup cruncher or lineup rewind the page should start loading very quickly. Prior to the fix I just applied, the page took close to 10 seconds to load even when the site had no one else on it.
It took me a while to piece all the clues together, If you would like to know the technical details of why this happened, here they are.
Sometime in November, I decided to add in usage rates to the NBA. We keep game data, and player data in seperate tables in our database. To add in the usage rates, I needed to reference player and game data so I was using a view in SQL which included joining these table rows together. This all seemed to work as intended at the time and allowed me to pull all of the data out together. This view would combine every player's stat row, with every players game log row from this season so I could calculate the usage rate. When I first implemented this, it worked much faster, since we only go back to the beginning of the season which meant fewer rows to join. As the season progressed, this part started growing bigger and bigger, making the NBA page load slower and slower. It didn't happen over night, which made it easy to go unnoticed, which it mostly did.
In November I noticed the database servers operating at higher than expected loads, which at the time I attributed to a growing number of users. We actually doubled our database servers in performance at that time (maxing out the size in the current tier), which masked the issue a little longer.
As the issue got worse and worse (because there were more rows of data everyday), the number of NBA users also started increasing. We had gotten to the point where the query to load NBA player data was taking 7-8 seconds, and using 100% of a CPU core, on a quad core machine. So what happened today, and last week was simply too many users loading that query and utilizing all of the system resources.
I ended up changing our database structure, and re-writing the query that pulls NBA data completely. What used to take ~7-8 seconds to perform and would use 100% of a CPU core, now will happen in around 4/10ths of a second and uses minimal CPU.
I sincerely apologize for this issue occurring, I am very confident it is now an issue of the past. It hurts knowing I let some of you guys down, I promise it was not intentional. I know a lot of you understand and don't blame me personally, and I really thank you for that.
It took me a while to piece all the clues together, If you would like to know the technical details of why this happened, here they are.
Sometime in November, I decided to add in usage rates to the NBA. We keep game data, and player data in seperate tables in our database. To add in the usage rates, I needed to reference player and game data so I was using a view in SQL which included joining these table rows together. This all seemed to work as intended at the time and allowed me to pull all of the data out together. This view would combine every player's stat row, with every players game log row from this season so I could calculate the usage rate. When I first implemented this, it worked much faster, since we only go back to the beginning of the season which meant fewer rows to join. As the season progressed, this part started growing bigger and bigger, making the NBA page load slower and slower. It didn't happen over night, which made it easy to go unnoticed, which it mostly did.
In November I noticed the database servers operating at higher than expected loads, which at the time I attributed to a growing number of users. We actually doubled our database servers in performance at that time (maxing out the size in the current tier), which masked the issue a little longer.
As the issue got worse and worse (because there were more rows of data everyday), the number of NBA users also started increasing. We had gotten to the point where the query to load NBA player data was taking 7-8 seconds, and using 100% of a CPU core, on a quad core machine. So what happened today, and last week was simply too many users loading that query and utilizing all of the system resources.
I ended up changing our database structure, and re-writing the query that pulls NBA data completely. What used to take ~7-8 seconds to perform and would use 100% of a CPU core, now will happen in around 4/10ths of a second and uses minimal CPU.
I sincerely apologize for this issue occurring, I am very confident it is now an issue of the past. It hurts knowing I let some of you guys down, I promise it was not intentional. I know a lot of you understand and don't blame me personally, and I really thank you for that.