Resilience 

in Software Architecture

Definition(s)

  • the capacity to recover quickly from difficulties; toughness.

 

  • the ability of a substance or object to spring back into shape; elasticity.

Resilience in Software Architecture

The Ability to recover (gracefully) with certain (unexpected) types/points of failure whilst remaining completely functional from the customer perspective view.

Sometimes Resiliency is called Recoverability.

Resilience in Frontend Matters

Autonomously working components

and external data make the need of adding up protective (resilient) layers.

 

Resilience in Frontend Matters

- Proxies (!)

- safeGetters

   - Facebook idx @compile-time

- Error Boundaries (e.g. try-catch, Promises, React EB, ...)

- Content Validation (e.g. checking if HTTP Request returned an image type)

- ....

 

- TypeScript 

 --> only helps Resilience in a closed ecosystem!

Resilience in Frontend Matters

The Costs of Resiliency 

and how to reduce those

Resilience in Frontend Matters

Finite State Machines can help you cutting down the options

Costs of Resiliency

Use EVERY point as a point of failure

Resilience in Frontend Matters

Unit tests can cover 100% what is beyond parameter verification.

Costs of Resiliency

function someFunction(param1, param2) {
  // we are not able to cover all cases of params. 
  // we can only ensure that a certain format is provided
  if (ensureValidation(param1)) {
    ...
  }

  if (ensureOtherValidation(param2)) {
    ...
  }

  // everything beyond here is potentially trustworthy 
  // and can be 100% covered by unit tests
}

Resilience in Frontend Matters

Coverage with unit tests is easier when you have abstraction layers

Costs of Resiliency

@import unitTestedLayer from '...';

export function abc() {
   /// ....

   unitTestedLayer.action();
}

Otherwise you introduce costs per module

Resilience in Frontend Matters

Downside

Costs of Resiliency

Abstraction Levels don't safe you from having costs per module on a runtime level 

- neither does not having abstraction levels

Resilience in Frontend Matters

Overcome breaking Web APIs with Messaging

Costs of Resiliency

// instead of
some.external.api.action();


// use 
publishMessage('i.need.external.api.action');

Resilience in Frontend Matters

When doing messaging: Set Response Limits

Costs of Resiliency

publishMessage('i.need.external.api.action', successHandler);

const clear = setTimeout(errorHandler, 5000);

function successHandler() {
   clearTimeout(clear);
}

Resilience in Frontend Matters

Resilience starts with Concept and Design!

Resilience in Frontend Matters

Proxy Sample

Resilience in Frontend Matters

How far do you go? 

Resilience

By activenode

Resilience

  • 408