From time to time we come across a website that seems to crash at every turn. Recently we worked with a company that was experiencing exactly this problem over and over again. From a user perspective their site ran extremely slow, with pages taking over 3 seconds to load or seemingly never loading. Sometimes the login process would stall or changes to your account would never update.
These problems often have to do with where your website is hosted or how it is built. After looking into the back end we realized this time it was probably a little bit of both, but that the first and fastest thing we could do to get some speed back was to move them from their existing host to AWS.
AWS hosting services include Lightsail, Amazon S3 and Amazon EC2. Each of these caters to different specifications and needs for site hosting.
- Lightsail is best for simple website hosting, like websites built on common applications like WordPress, or built on popular development stacks like Node.Js, sites that don’t need to scale and for those who want to manage their own web server and resources.
- Amazon S3 is best for websites that do not contain server-side scripting, change infrequently with few authors, only need to scale for occasional intervals of high traffic and for those who do not want to manage infrastructure.
- Amazon EC2 is best for websites that use multiple web servers across multiple data centers, that need to scale using load balancing, autoscaling, or external databases, that require sustained high CPU utilization and for those who need maximum control and flexibility for their web server configuration and admin.
For this project we were torn between using Lightsail or Amazon EC2 because of the continual and dynamic issues with the website crashing and stalling. But because the website was for a business that has the potential to have a lot of traffic we decided Amazon EC2 was the better option as it is best for social, travel, and other application-heavy websites, plus it can dynamically scale be able to support the potential for high traffic.
Before we moved them to EC2 we ran some load tests using Nouvola to see how slowly things were moving and if we could identify what kinds of errors the site was getting. We did a small load test of 20 users over a ten minute period of time.
During the first test we were getting mostly 0 and 400 errors, 0 errors usually means that the server is not reachable and 400 errors mean the server cannot process the request for some reason. In total we were getting about 18% errors and about 20% no response and our goal is to see both these numbers go down. We also saw that the site was loading very slowly in general sometimes taking up to two seconds to load a page.his might not seem like a lot, but in terms of usability is not the best. The back end also crashed very easily without many users interacting with the site.
After we moved the website to EC2 we ran the same load tests again through Nouvola to confirm that the move was a success. This time we only got 10% errors and 0% no response; we also did not get any server errors related to the this site alone, only with connections to other sites that integrated in. The response time decreased to around 161 milliseconds and the backend was able to keep up with requests without crashing.
We saw this as a major success and a perfect example of why AWS is one of the best options available for website hosting. They can accommodate so many different types of needs that it really doesn’t make sense to go with anyone else.