From Heroku to AWS
The client's mission statement was to migrate a Laravel backend (admin + api) from Heroku to AWS. Heroku's dynos became increasingly expense, but moreover, the overall system suffered from instabilities.
In AWS we created a production and a test environment for this specific app:
- An autoscaling Elastic Beanstalk app, with separate components for API, admin and 'worker'
- A shared application load balancer to terminate SSL and redirect all traffic to the appropriate targets
- Deployment pipelines for continuous delivery/integration, with immutable deployments without offline time
- A redundant Elasticache/redis cluster
The deployment pipeline can be triggered by a simple git push. The database setup was pre-existing and already running on AWS.
Load / Stress testing
To configure and evaluate the new cluster, we executed some stress tests on the old and new environments.
We used the first test to configure the machines accurately so it would not suffer from memory problems even under the heaviest load.
Results of the other tests showed the new cluster was 30% more performant than the Heroku setup.
At the same time, the Heroku setup reached critical levels, while the AWS setup did not even enter the autoscaling phase.
Savings compared to Heroku are estimated at 60%.
For even higher scalability we deploy 'spot instances' (besides a stable 'on demand base') - effectively, unused capacity at AWS is used to create more redundancy offered at a much lower price than the on demand price.