- Steve Sokolowski

- Archived posts: 4559
- Joined: Aug 27, 2014
Improved website performance
Over the past few weeks, website performance has become a problem. At first, we simply increased the number of cores on the server to 6, but CPU usage then increased to a steady 1200%. After some investigation, I determined that, for some reason, the url /user/checkPassword was being called 570 times per second. This URL is used to determine if a user has two-factor authentication enabled. Even though users are banned after 25 invalid password attempts, there would be thousands of calls from the same IP addresses despite that IP address never being able to log in again, even if valid credentials were provided.
We changed the system so that on the 26th attempt, the IP address is now added to hardcoded list. That way, these requests will no longer load the entire Grails framework and query the database just to reject the request. If the IP address is on the list, all packets received from it are simply dropped, saving CPU load. About 17,500 addresses have already been added to the list.
We were able to reduce the CPU load on the website from 1200% to 130% after two hours of recording these addresses, and the number of checkPassword requests dropped from 1 million per hour to 80,000. Google Analytics reports that the change improved page load time from 7 seconds to 4.2 seconds. Feel free to share your observations on performance below.
We changed the system so that on the 26th attempt, the IP address is now added to hardcoded list. That way, these requests will no longer load the entire Grails framework and query the database just to reject the request. If the IP address is on the list, all packets received from it are simply dropped, saving CPU load. About 17,500 addresses have already been added to the list.
We were able to reduce the CPU load on the website from 1200% to 130% after two hours of recording these addresses, and the number of checkPassword requests dropped from 1 million per hour to 80,000. Google Analytics reports that the change improved page load time from 7 seconds to 4.2 seconds. Feel free to share your observations on performance below.