Designing software for the enterprise - Pt.1 Reliability
Tags: software, architecture, enterprisesystems, reliability
Published: 2020-03-07 12:45:12

---
title: Designing software for the enterprise - Pt.1 Reliability
published: true
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/xqd9t2u6asl28yf3wx03.jpg
description: High-level rules to design reliable applications
tags: software, software architecture, enterprise systems, reliability
---

**Building software for the enterprise is hard.** Many things go wrong if the important decisions on the architecture of the system were not previously planned.

One of the enduring problems related to this kind of software is how to manage data since such applications meant to grow fast and produce large datasets in a few months.

Since the application needs to be constantly evolving, it should be reliable, must be scalable and easy or not too hard to maintain.

In this post, I want to focus on the first pillar, **reliability**.

Reliability
-----------

You may have an idea of what reliability means when it comes to software.

The concept is usually associated with *fault-tolerant* systems or systems that can tolerate *failures* and keep things running from the user's perspective.

[Note that a fault is not the same as a failure.](https://resources.sei.cmu.edu/library/asset-view.cfm?assetid=11747)

> A fault is usually defined as one component of the system deviating from its specs, whereas a failure is when the system as a whole stops providing the required services to the user.

Because of that, we should design systems that can tolerate-faults in three different areas, **hardware** errors, **software** errors and **human** errors.

In this particular section, I want to focus on one of the main reasons for software outages: **Human Errors.**

[A study found](https://static.usenix.org/events/usits03/tech/full_papers/oppenheimer/oppenheimer.pdf) that only 10-25% of outages were caused by hardware or network failures, and the other 75-95% were caused by configuration errors by operators, or in other words, humans.

**So if human errors represent the majority of system outages, what can we do about it?**

Well, most software is usually designed by humans - *well, at least in 2020, not sure the next 5~10 years* - and humans know not to be very reliable.

It's not our fault, we just can't sustain the same work quality level every single minute.

To solve that problem we need to design **mistake-proof** systems.

So instead of trying to cure failures, you should start preventing them:

-   Have a solid [code review process](https://storage.googleapis.com/pub-tools-public-publication-data/pdf/80735342aebcbfc8af4878373f842c25323cb985.pdf). Bugs can be found on a good code review process. Those can prevent stupid things that people usually do when coding for several hours or days.

-   Make sure to have [integration tests](https://kentcdodds.com/blog/unit-vs-integration-vs-e2e-tests) covering important features of the system. This kind of test makes sure that **real-world business rules** remain intact during the evolution of the system.

-   Look for [design patterns](https://refactoring.guru/design-patterns/catalog) to build high-level abstractions to prevent people from changing low-level functions.

-   Cut off production database access or restrict permissions to important services. Instead, build a CLI (*Command-line interface*) or an [Admin interface](https://en.wikipedia.org/wiki/Back-office_software) so they can do their work without screwing things up.

-   "Adding human resources to a late software development project makes it later." - **[Brook's Law](https://en.wikipedia.org/wiki/Brooks%27s_law) -** So instead of hiring more people, try installing a solid process such as [continuous delivery](https://martinfowler.com/bliki/ContinuousDelivery.html) and [continuous integrations](https://martinfowler.com/articles/continuousIntegration.html) to deliver more value in less time with more safety.

-   Provide sandbox environments so people can test configurations and new features before actually going to production. Providing a docker setup for developers that has the same configuration as the production servers will prevent configuration errors.

-   Use rollout strategies to prevent mass outages. It should be easy to revert configurations or deployments before they can cause a wide system failure. [Blue-green deployments are essentials](https://martinfowler.com/bliki/BlueGreenDeployment.html). When it comes to databases, make sure to use migrations to quickly revert things.

-   "A complex system that works is invariably found to have evolved from a **simple system that worked**. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system." - [Gall's Law](https://en.wikipedia.org/wiki/John_Gall_(author)#Gall's_law)

-   Use logs to keep track of systems' health, together with monitoring and alerting services. Softwares as **New Relic**, **Prometheus**, **Grafana**, **CloudWatch** and **PagerDuty** combined can give you a clear view of your application and infrastructure health, as show you early warning signals of failures.

---

So, to sum this up:

> The reliability of your system depends on how bug-free it is, how good you are at monitoring it, and how well you have protected against the myriad issues and problems it has. - [Jay Kreps](https://blog.empathybox.com/post/19574936361/getting-real-about-distributed-system-reliability)

---

### Recommended resources

-   https://en.wikipedia.org/wiki/Brooks%27s_law

-   https://www.amazon.com/Mythical-Man-Month-Software-Engineering-Anniversary/dp/0201835959

-   https://martinfowler.com/architecture/

-   https://refactoring.guru/

-   https://en.wikipedia.org/wiki/John_Gall_(author)#Gall's_law

-   https://blog.empathybox.com/post/19574936361/getting-real-about-distributed-system-reliability