How to (not) lock yourself into architectural drawbacks, or, Microservice architecture as the reification of Pi-Calculus by Eduardo Bellani

Reification: the treatment of something abstract as a material or concrete thing, as in the following lines from Matthew Arnold’s poem “Dover Beach”: (Britannica 2018)

/The Sea of Faith
Was once, too, at the full, and round earth’s shore
Lay like the folds of a bright girdle furled./

The microservice architecture(MA) has taken a deep hold in the collective imagination of the software engineering community since at least 20141. This has happened despite serious and well documented drawbacks.

Such combination calls for an explanation. A sketch of such explanation is my intent here, starting with what MA is, at bottom. At a later date I intend to provide a history of how it came to be a dominant architecture on our industry.

My position is that MA is a reification(Britannica 2018) of abstract processes as defined by the Pi-Calculus (PC). Why do I think of that? Let’s start by defining things.

Definitions

PC is a model of message-based concurrent computation and its essential features are(Pierce 1997):

More concretely:


π-calculus lets you represent processes, parallel composition of processes, synchronous communication between processes through channels, creation of fresh channels, replication of processes, and nondeterminism

A process is an abstraction of an independent thread of control. A channel is an abstraction of the communication link between two processes. Processes interact with each other by sending and receiving messages over channels. (Wing 2002)

Here is the best definition of the MA that I know of:

The microservice architecture pattern structures the system as a collection of independently deployable services that communicate only via messages through service interfaces. (Bass et al. 2021)

How are they mapped?

So here is PC is mapped to MA:

  1. Processes are Services(binaries loaded into memory),
  2. Channels are either queues or some form of APIs (RPC or REST),
  3. Messages are network calls,
  4. The avoidance of shared variables as an avoidance of a shared DBMS.

Conclusion

The reader might well ask, so what? Isn’t that a good thing? Well, no, it’s a very bad thing. Why?

Because once you mistake a formal entity such as the PC with a material one such as the MA, you lock yourself out of possibilities and in specific drawbacks that might not exist in other ways to implement the PC.

Let me illustrate the point here with a metaphor:

Say you think the formal entity called Boat can only be implemented by Yacht. You now are locked into the design choices of that concrete instantiation of the Boat form. Transatlantic or Canoe are not possible for you.

Coming back to the case at hand, here are some examples of how you could implement the pi-calculus without MA:

Appendix: The Drawbacks

(Ghemawat et al. 2023)

Figure 1: Cathedral of Phnom Penhl, destroyed shortly after by the Khmer Rouge. The Ministry of Posts and Telecommunications now stands on the site of the former cathedral

Figure 1: Cathedral of Phnom Penhl, destroyed shortly after by the Khmer Rouge. The Ministry of Posts and Telecommunications now stands on the site of the former cathedral

References

Bass, L., P. Clements, R. Kazman, and an O’Reilly Media Company Safari. 2021. Software Architecture in Practice, 4th Edition. Sei Series in Software Engineering. Addison-Wesley Professional.
Britannica, The Editors of Encyclopaedia. 2018. “Reification.” In Encyclopedia Britannica. https://www.britannica.com/topic/reification.
Ghemawat, Sanjay, Robert Grandl, Srdjan Petrovic, Michael Whittaker, Parveen Patel, Ivan Posva, and Amin Vahdat. 2023. “Towards Modern Development of Cloud Applications.” In Proceedings of the 19th Workshop on Hot Topics in Operating Systems, 110–17. Hotos ’23. Providence, RI, USA: Association for Computing Machinery. https://doi.org/10.1145/3593856.3595909.
Pierce, Benjamin C. 1997. “Foundational Calculi for Programming Languages.” In The Computer Science and Engineering Handbook, edited by Allen B. Tucker, 2190–2207. CRC Press. http://dblp.uni-trier.de/db/books/collections/tucker97.html#Pierce97.
Wing, Jeannette M. 2002. “Faq on $\Pi$-Calculus.” https://www.cs.cmu.edu/~wing/publications/Wing02a.pdf.

  1. https://trends.google.com/trends/explore?date=all&geo=US&q=microservices ↩︎

  2. In a certain sense, all externally facing APIs face this. Microservices just make this problem worse by making everything external and not part of the same checkable runtime. ↩︎