WebApp Performance Slashed by 99.6%
As a company who develop 21st century web monitoring software that can measure uptime and performance, we can hardly allow our own WebApp performance to be poor, can we?
An inevitability of our software is the constant generation of data. As our customer base grows, with more and more monitors being created, the sheer quantity of data we will be storing is going to grow. This means that no matter what we do to optimise our architecture, infrastructure and code, there will always be a bottleneck in processing data out of the database.
Recently we noticed some of our older accounts (mostly our own) had begun to slow when delivering statistical data from the API to our WebApp. We found that the sheer quantity of data that the API was processing and delivering to the front-end was producing slow load times and hindering the WebApp performance. As the image shows, some individual API calls were taking as much as 1.3 minutes each. After checking database indexes, code efficiency and hardware abilities, it was evident that something more drastic had to be done.
The Solution
We decided that pre-processing data seemed like a good option and after some proof of concepts, we were convinced this was the way to go. By creating ‘rollup’ tables we would be able to reduce our data to process down from ~600 rows per monitor per day to 1 row per monitor per day. After a few days of test driven development, some careful indexing and a couple of hours for our scripts to run, we had generated our rollup tables!
Finally, we needed to switch the data sources on our statistic calculations from the raw data to the rollup data. This was relatively easy and we quickly saw our API response times reducing dramatically. As you can see from the images, some of the API calls dropped from around 1.3 minutes, to ~300 milliseconds!
There are still areas we feel like we can improve – shipping out a lot of our raw data into other storage methods would dramatically reduce the size of our database, but for now what we have implemented has achieved what we need to achieve and improved the usability in many parts of the WebApp for our older accounts.