Whenever I start a building a new app or service, I always plan out the building blocks that I need. Depending on the size and complexity of the project, I might decide on a monolith or microservice or I might go even smaller. Yes, I am talking about nanoservices. Ranking from most to least complex, we have the monolith (it does everything), the microservice (one service or capability), and the nanoservice (just one function). An overly simplistic example might be a photo gallery web app, the image management API, and the thumbnail generator.
A nanoservice performs a single atomic function, and it does it well. Nanoservices are also lightweight and do not suffer from the startup penalty when launched. They can also operate in isolation. For example, the example thumbnail generator takes an image as input and returns a fixed size thumbnail image. It does not need any metadata or usage context. One input, one output. Because of their simplicity, you can design, build, test, and deploy nanoservices very quickly. Their size also makes them very portable and a perfect fit for serverless environments.
Building our example photo gallery with only nanoservices also adds some overhead. For example, our app might need to make multiple nanoservices calls when a new images is uploaded - eg, write the image to object storage, thumbnail generation, EXIF data extraction, tag generation, geolocation, write the image to object storage, update the database, etc. Each of these calls can add latency when adding an image to a collection. While we might be able to deploy the thumbnail generator with minimal risk of breaking anything else, we still need to create new deployment pipelines for each service. Of course there's also multiple health checks to create. Similarly, if you have to update a common library or package, then you're going to be doing it multiple times.
I have built a few nanoservices for my personal projects. The latest services are related to my digital twin effort. The one that gets the most usage is my watermarking service. I pass it an image, and it returns an updated version with my watermark stamped on the lower right corner. All of my nanoservices are Python based, but I am not using any specific framework. I see that there are a few emerging tools for building nanoservices, and I should probably set aside some time to investigate them. Building nanoservices in your environment? What tools are you using?