Highly Available (HA) Cloud Infrastructure For Spree Commerce
Nginx Ingress Controller, Docker, Grafana, Prometheus, EFK stack, Scoutapp, AWS, Redis, Kubernetes, Jenkins, RDS PostgreSQL, CloudFront, AWS S3, AWS Load Balancer
There were multiple issues with the eCommerce Platform when we came on board to redesign the infrastructure:
1. The eCommerce site was crashing quite frequently.
2. The AWS cloud infrastructure was not developed to handle the growing demand. It was designed with a single EC2 instance over 3 years ago when the traffic to the site was very low.
3. There was no CDN enabled.
4. The images and static content were being served from the same server.
5. The admin interface for managing content, dashboard, EDI, batch uploads etc. is also being served from the same server.
6. eCommerce landing pages and call center were using the APIs via the main site itself.
7. EDI server would constantly crash.
We created a highly available AWS infrastructure using Docker and Kubernetes. With Kubernetes, we created multiple worker nodes with optimized docker containers using the alpine version of docker images where possible to reduce deployment time and increase application performance. We also configured a CI/CD deployment pipeline.
We also divided spree into four separate containers
1. Main site and checkout
2. SPREE API
3. SPREE Admin
4. SPREE EDI
This allowed us to better maintain and monitor SPREE. Dividing the containers also gives us much-needed insight on how many resources were being used at each section of SPREE and allow the development team to optimize the code where needed.
The highest number of requests we received at the time was about 60000 with about 5000 users on the site. We had better monitoring and alert mechanism in place. The eCommerce site never went down in last 4 months. We are now able to manage the maintenance without bringing down the server. The client saw an increased conversion by over 40%. This conversion is very high because of the above infrastructure business is able to put more marketing efforts hence the increased conversion.
We optimized the N+1 queries that were being run by Spree Commerce and used Redis caching heavily for database queries.