• Home
  • Blog
  • Best Practices for the development of Microservices

Best Practices for the development of Microservices

Best Practices for the development of Microservices

From the experience of many projects , we have compiled a guide for the development of microservices.


Kubernetes Special Features

Writing to the hard disk

Write to root always on layered filesystem.
In Kubernetes, there is a special storage for volatile writes.
Root filesystem should always be mounted read only.


Scaling in Kubernetes only Horizontal
Services are always run behind load balancers.
Standard answer for HA and Selfhealing

Liveliness probes/Watchdog

Basically, error conditions should be identified in the service if possible.
However, health checks should not work to uniquely identify
From Kubernetes point of view standard response for self-healing


Scale out requirements


Services should be stateless if possible.
If a state cannot be avoided, it must be made known to all instances
Kubernetes Service LBs donot support Sticky Sessions. Only possible by Tricks.

Fault Tolerant

Errors are normal and happen (Liveliness Probes!).
Example: At least once vs. at most once messaging (Acknowledged messaging vs Fire and forget).


Self-contained system, responsibility transitions
Services decide about all states completely and autonomously.
Example: deletion, config, transactions


Every services is responsible for it’s own consistency
Attention! Observe dependencies to other services.


Queueing helps to smooth load peaks because processing can be delayed.
Very suitable for time- or compute-intensive tasks.
Attention! Asynchrony is very amplified here. (Several requests against the same information can overtake each other. Race Conditions!)


Other Planning Support

Avoid shared resources

Microservices are based on maximum parallization
They always act in a serialized way


Statistic Configuration by environment variable
For large configuration sets also via Config files.
dynamic configuration in application dabase​


Strong means for performance and to reduce computing power
Use only for read accesses if possible
Invalidate cache after writes
For large volumes and infrequent writes, cache should be created in the background


Challenges with Microservices

Microservices are distributed systems

Distributed systems are always subject to compromises
CAP Theorem
Eventual Consistency​
IMPORTANT. This decision must be made consciously


Special attention for deletion, backup, etc.
Transactions only by overlapping ID Possible
Worst case freeze => contradicts autonomy and therefore does not scale! ​​



Check out our latest blogpost

Integrating WebAssembly with Kubernetes: Boosting Security and Portability

WebAssembly enhances Kubernetes with improved application portability and robust security, making it a game-changer for cloud-native environments.
Design Escapes