The team at Google has recently introduced Service Weaver, an open-source framework for building and deploying distributed applications that allows users to write apps as a modular monolith and deploy them as a set of microservices.
Service Weaver is made up of two core pieces. The first is a set of programming libraries which allow customers to write an app as a single modular binary with native data structures and method calls. The second is a set of deployers which assist in configuring the runtime topology of an application and deploy it as a set of microservices, either locally or on the cloud.
“Most people believe, by default, their application should just be built as a collection of microservices. I think the challenge with that is that people end up creating way too many services, introducing things like latency and network boundaries way too early in the process and they end up building distributed monoliths,” said Kelsey Hightower, Google Cloud’s principal developer advocate, during a Twitter Spaces live.
According to Google, through the decoupling of writing the application from runtime considerations, Service Weaver is geared at improving the development speed performance of distributed applications.
Google stated in a blog post that this open-source release came about to solve the challenge of reducing the overhead that comes with maintaining multiple different microservice binaries, which can slow development significantly, as well as make it easier to make cross cross binary changes.
“I think one of the things that you quickly see as you run through the tutorial is that instead of you invoking methods directly as you normally would, the framework really gives you all of the tools necessary to think about being a client of that particular module even when you are still running in that monolith,” said Hightower.
With Service Weaver, users can write a single binary with only language-native data structures and method calls, then organize the binary as a set of modules native to their programming language called components.
The v0.1 release of Service Weaver brings users the core Go libraries used for writing applications, multiple deployers for running applications either locally or on GKE, and a set of APIs that enable the user to write their own deployers for any other platform.
To learn more, read the blog post.