Modern cloud-native C++ microservice (2 Part Series)
Let’s make Solidity compiler microservice
Now we could make C++ and NodeJS version of microservice and check which will be faster. Theoretically, C++ version should be much faster.
Now Let’s define requirements and service architecture. Before that, we need to learn what microservices are.
Cloud-native description, according to CNCF.
Cloud native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach.
These techniques enable loosely coupled systems that are resilient, manageable, and observable. Combined with robust automation, they allow engineers to make high-impact changes frequently and predictably with minimal toil.
Cloud-native apps are developed with loosely-coupled microservices, allowing each microservice to function only as needed, as well as be updated/altered as needed, rather than requiring the full application to run aggregately.
In this article series will be described and implemented a few key attributes of Cloud-Native app.
APIs for interaction and collaboration
Observability and analysis
Worker Service should be able to compile solidity contracts to binary representation. The worker should use pub/sub pattern to interact with other services.
The Publisher publishes contract jobs to the Redis, workers do jobs and publish compiled contracts back to the Redis.
Service should be containerized and managed by orchestrator(Docker, Kubernetes)
Service inside container should be configuable by command line arguments or env variables.
Service logs should be formatted and structured
Service should provide health check
Service should metrics to observability service
We will use two most popular Linux distro as docker base images: Ubuntu, Alpine. Alpine Linux is based on musl C library and BusyBox and gives tiny images, but it could be slower in some cases. First reason is glibc, second is default optimization compile option. I read somewhere, that packages build with compile option
-Os which means “optimize for size” not for performance.
Cloud native C++ microservice. Part 3 —Dependencies, Package Managers, Conan.io
Cloud native C++ microservice. Part 4— Observability
Cloud native C++ microservice. Part 5— Databases
Cloud native C++ microservice. Part 6— Auth, JWT
Cloud native C++ microservice. Part 7— API, REST,GRPC