How to make resilient application?
This question was asked recently in an interview. And I was like š®.. I told some of the things I remembered but later realized how many I missedš
As you know āResilientā means āable to return quickly to a previous good condition after problemsā or āable to quickly return to its usual shape after being bent, stretched, or pressedā
So Resilient applications will come to their healthy state even after a traffic spike, DDOS attacks, and other failures. I tried here to list down all the things that make the application resilient.
1. Diversify Infrastructure: multi-region/multi cloud failover/DNS failover technique
2. Make it Microservice-based
3. Do Chaos Engineering and see weaknesses. Now you identified the problems, start solving them.
4. Balance workloads cost-effectively between resources during periods of sustained heavy usage. Teams can set up controls to steer traffic to low-cost resources during a traffic spike
5. Monitoring the health and response times of each part of an application and systems to get ahead of performance fluctuations, outages or other problems.
6. As organizations take a closer look at their approach to resilience, they must consider the costs vs benefits of each strategy.
7. Optimize costs and resource consumption.
8. Minimize app downtime.
9. Ensure that user demand can be met during periods of high usage.
10. Improve quality and availability of service.
11. Ensure that user experience and trust are maintained during any outages.
12. Minimize time spent investigating failures
13. Spend more time on developing new features by using managed services provided by cloud providers.
14. Minimize repetitive toil through automation.
15. Build apps using the latest industry patterns and practices.
16. Reduce the frequency of failures requiring human intervention.
17. Increase the ability to automatically recover from failures.
18. Minimize the impact from the failure of any particular component.
19. Use Infrastructure as code (IaC) technique
20. Take advantage of continuous integration and continuous deployment (CI/CD) pipelines, so that any changes to your configuration can be automatically tested and deployed.
21. Immutable infrastructure mandates that resources never be modified after theyāre deployed. After youāve tested and validated the changes, you fully redeploy the resource using the new configuration. In other words, rather than tweaking resources, you re-create them.
22. distributing compute resources, load balancing, and replicating data.
23. If a service exists in multiple zones or regions, it can better withstand service disruptions in a particular zone or region.
24. use managed services to consume parts of your application stack as services. You then get an availability SLA.
25. Configure autoscaling
26. Minimize startup time
27. Use pre-baked images
28. Containerize your app
29. Break your app into independent services
30. Favor modular architectures
31. Aim for statelessness
32. Monitor at all levels
33. In microservice architecture, communication between them result in cascading failure. Adopting techniques like the circuit breaker pattern, exponential backoffs, and graceful degradation. These patterns increase the resiliency of your app either by giving overloaded services a chance to recover, or by gracefully handling error states.
34. Choose different types of storage for different parts of your app for scalability.
35. Caching supports improved scalability by reducing reliance on disk-based storage.
36. Caching can also increase resiliency by supporting techniques like graceful degradation. If the underlying storage layer is overloaded or unavailable, the cache can continue to handle requests. And even though the data returned from the cache might be incomplete or not up to date, that might be acceptable for certain scenarios.
37. The ability to execute a comprehensive set of unit, integration, and system tests is essential to verify that your app behaves as expected. As the percentage of your codebase covered by tests increases, you reduce uncertainty.
38. Continuous integration and comprehensive test automation give you confidence in the stability of your software. And when they are in place, your next step is automating deployment of your app.
39. Validate and review your architecture
40. Always be architecting