Organic Service Architecture: Concepts

A Microservices Architecture Inspired By Living Beings

Red Blood Cells from


While being a devoted programmer, I like to spend my spare times on art and drawing. In fine arts, it’s known to make better figure drawings, it’s required to have at-least a slight understanding of human anatomy. This’s how I got acquainted to the body structure.

According to the anatomy textbooks, there are eleven systems in the human body. Each system cooperates with another to fulfill various task, i.e., almost every task is done by several organs not belonging to the same system. These are naturally making a super system which is able to survive on its own.

Finding these out, I wondered if these characteristics can be adopted to make self-sufficient service architectures, too. What follows, is a trial to make such an adoption and to address feasibilities and issues.

Disclaimer. This article is based on my own thoughts, but I’m unaware if this peace of work is genuine—and I’m too lazy to do a research—so, if you find any similarities with works done before, that’s for sure, a mere coincidence. Also, it’s published without any warranties … bla bla bla … so, use it at your own risk.

Building Blocks

Cells are the essential building blocks for every organ, and the body as a whole. Each cell is autonomous and unaware of other cells, but somehow knows its purpose. Cells have a tight connection with the blood, consuming chemicals and converting it to vital products (and also, wastes) which are further thrown back into the blood.¹ Besides, body cells are impermanent and are about to die (or technically, fail) eventually.

Here, we can find some similarities between cells and microservices, mainly as they’re also designed to be autonomous and ready to fail. But, there’s a big difference about what happens when a microservice/cell dies. After the death, cells do not reborn, in contrast with how high-availability works. Cells ensure the viability of the organ by replication.² The replication occurs as part of the cell cycle. When a cell grows over time, it finally gets divided into two younger cells. This process is faster at early moments of life, leading to growth in the organ, but somehow—beyond my skills—reaches an equilibrium state where death and birth rates are equal.³

Intermission. One of the unanswered mysteries of biogenetics is that cells—despite their wide range of varieties—are all born through replication from a single stem cell.

Now, let’s see how these can be adopted for microservices. Microservices are typically implemented as single processes and they’re allowed to use a very limited amount of resources.⁴ So, if we define growth as an amount consumed by a microservice related to its total available resources, when a microservice reaches its limits⁵, it is time for it to replicate. The replication in the OS world is best known as forking. The fork system call, creates a new process as an exact copy of the same process, but with distinct resources—the child process is further detached from its parent, for sake of independence.

Cell Replication via Forking

However, forking over multiple clusters is not supported. We can solve this problem by thinking of instances of the same microservice across multiple clusters, as limbs or organs of the same kind in the body, such as kidnies, with each limb/organ growing independently.

On system startup, when a microservice is seeded, it replicates to a minimum viable size via growth hormones—explained later—to prevent a sudden death by an early failure.

Circulation and Communication

As stated previously, each cell is tightly connected with the blood, and this is the medium by-which it communicates with the outside world. The cell is able to absorb certain nutrients and hormones through its membrane, and throw away products and wastes. Further, the products and wastes are typically consumed/collected by other cells during the circulation process.

Circulatory system is a big network of vessels traveling among all the organs, and the heart pumping the blood through them. The vessels are connected in the way that guarantee blood cells to meet every organ. The blood, itself, acts as a carrier for oxygen, nutrients, hormones and wastes.

From software point of view, the circulatory system can be modeled as a round-robin message delivery system.⁶ However, circulating messages across all the organs can cause serious latencies by presenting the messages to many irrelevant microservices. To prevent these latencies, we define atria and ventricles.⁷

Suppose that there are several distinct circulations in the system. Each circulation passes among a finite set of organs, and has exactly one ventricle which is responsible for pumping the messages. Each message, completing a round, enters an atrium just before returning back to the ventricle.⁸ The atrium has several valves which act as one-way doors to ventricles. A valve has a certain filter which allows only a specific set of message types.

With this approach, messages circulate through a shorter network—causing the latencies to decrease—and if needed, reach to other networks by passing automatically through atria and valves.

Supervisory and Control

Although cells are autonomous, no body can survive without a brain. The brain is the center of the nervous system and has the ultimate control over all of the organs. The brain applies the control by gathering the information from the senses and processing them, commanding the muscles to move or driving secretion of hormones.

In an organic software world, a brain is a central supervisory and control unit which has 4 functionalities:

  • Spreads sensors (or spies) all over the system to gather information about all occurring events. Sensors are connected to the brain directly through fast and unidirectional neurons, sending event signals by-which the brain monitors the state of the system.
  • Manages the clusters by deciding where to put seeds.
  • Asks the circulatory system to create new circulations (or networks).
  • Controls utilization by commanding the organs to grow or shrink.

The brain can directly command cells via hormones. Hormones are targeted messages released by the brain into the blood. Also, hormones have priorities which define the order at-which the cell processes it among all the absorbed messages.

Two common hormones are the growth hormone and the death hormone. The growth hormone is generally released when a seed is placed, in order to grow an organ to a minimum viable size. Receiving a growth hormone, the cell replicates immediately without question. The death hormone acts similarly, but in the way its name implies.

Wastes and Disposal

Many chemicals are produced as results of cell metabolism, which some of them, like carbon dioxide and uric acid, are considered as wastes. These waste chemicals are further dissolved in the blood, leaving the cell, and collected and disposed by lungs and kidneys.

There are no actual wastes in this software system, but unprocessable and expired messages. Expired messages can be determined by maximum number of hops they can make through atria. When a message passes through an atrium, its hop count increases, and when it reaches the maximum number of allowed hops, it is marked as waste. Marked messages are not processed, but directed toward a garbage collector. A garbage collector is a special type of cell absorbing only marked messages.

Protection and Security

Human body has a multi-level and very complex protection system. The skin protects internal organs by keeping threats out. Enzymes in saliva and gastric acid are toxic for many micro-organisms. But if pathogens make it into the blood, they’re subjected to antibodies that mark them to be swallowed by white cells. The body, despite being successful for fighting invaders, it has less power against diseases caused by abnormal behavior of cells, e.g. cancer.

We always try our best to protect our systems at early stage, using firewalls and sanitizers. We can also lower the risks by determining maximum number of allowed hops for suspected messages wisely. However, any cell might get diseased either by itself, or consuming pathogenic messages.

Sensors are responsible for detecting diseased cells. There are signs to detect them, such as: not responding to health checks for a long time, consuming an unusual amount of resources, contaminating the blood by throwing too many messages, etc.

Detecting a diseased cell, the sensor signals the brain to shot the cell dead. If, by any chance, too many cells are shot, the brain tries to put new seeds or releases growth hormone to increase the population back to normal.

What’s Next

What explained here, is a naive and conceptual adoption of human anatomy in search for a sulf-surviving service architecture—that I like to call it an organic service architecture. This is the first of a series of articles, which targets to adapt microservices architecture with an organic system, but doesn’t prove anything. In the upcoming articles, I try to dive deeper into implementation details.

¹ It is known that the cell’s membrane is embedded with various proteins acting as channels to allow different molecules in and out of the cell. Technically speaking, the membrane acts like a firewall and embedded proteins as ports.

² Biologically, division is a more precise word to be used here.

³ This is almost true about healthy mature bodies, but there are situations where the so-called equilibrium is broken, e.g. encountering a damage.

⁴ With resources, we usually mean memory and CPU cores.

⁵ Usually, the replication limit is smaller than the overall limit.

⁶ Several message queuing systems, such as RabbitMQ, support such an approach.

⁷ Atrium and ventricle are different things in reality, but I felt it’s ok to misuse these words for sake of consistency.

⁸ One can think of atria as conjunction points of circulations.

Passionate Developer