Learn how to provide an overview of the multitude of available Go microservice frameworks and application platforms.
- [Instructor] Hi, and welcome back to Advanced Cloud Native Go. My name is Leander Reimer, and I'm happy to be your host. Overview of Go Microservice Frameworks and Libraries. So, in this video, we're going to take a look at individual microservice libraries and some examples. And last but not least, an overview of individual web frameworks you can use to develop you microservice and also some examples here. So, let's get going then. So, what I've prepared here is a rough overview of individual libraries, service frameworks, and web frameworks.
Obviously, this list is not complete. And I also invite you to do your own research on the web to find some libraries, frameworks, and web frameworks which you might use instead. So, what I tried here is, well, to address several different concerns which you might come across when you want to develop Cloud Native applications. So, for the individual libraries, for example, I've noticed here and implementation of a circuit breaker called Hystrix.
You might want a library to collect metrics. You definitely need a library for some logging. You need a library such as gRPC to do some synchronous RPC-based invocations. And again, with MonKit you have a library for monitoring. The next level up in the ladder of abstractions are service frameworks. They provide you with an opinionated collection of different things like Gizmo, Go Micro, Go Kit, or Kite.
And next up, there are some web frameworks, like Gin Gonic, Gorilla, Goji, or Go Martini. So, let's have a look at them. So gRPC, for example, is a Go language implementation of gRPC. So, this is the Google RPC framework. So, a lot of the later service frameworks will use this or base their clients server communication on gRPC. So, if you're looking for this, have a look at this Git repository.
So, here find the prerequisites. Here's the installation instructions. And here's a quick start guide which you might find helpful. The next thing I mentioned is Hystrix. So, you might have heard of Hystrix before. It's a latency and fault tolerance library initially developed by Netflix. And this is the Go implementation. So, this is a key ingredient in any synchronous communication.
So, basically what you do with Hystrix is you guard any synchronous call, any synchronous outgoing call with a so-called circuit breaker. Again, here's how to use it. And again, here you find a few basic examples how you can incorporate Hystrix into your code. So, what you can do here is you have a synchronous API. What you do is you guard the call to an external service using one of those commands.
Also, here go-metrics, for example. Golang library for exporting performance and runtime metrics to external systems. Also, here it does support several sinks. We might find the StatsdSink or the Prometheus Sink very helpful. As usual, here are a lot of examples which help you to incorporate this library into your code. Another interesting library is MonKit.
It allows for flexible data processing, metrics, monitoring, instrumentation, and tracing in Go. This is essential for your diagnosability triangle. Remember, we're here in a massively distributed system. So, we need some form of library to help you with the monitoring instrumentation and tracing of this distributed system so you can do fault analysis later on. So, same here. Example usages provided which give you a quick start in how to incorporate this library.
Logrus, for example, you can use it for structured and pluggable logging in Go. Or see here, if you want some nice, fancy colored log output or maybe some structured JSON formatted output, Logrus will help you here. So, those are individual libraries. Next up service frameworks. Go Kit, for example, is a standard library for microservices. So, here you find some of the goals. So, RPC is the primary messaging pattern supported by this library.
But you can have pluggable serialization and transport protocols. So, it's not just JSON over HTTP. So, it can also use gRPC, for example. They also support async messaging patterns, like publish/subscribe or CQRS. So, we will be using this one in one of our examples later on in this course. Another interesting one initially developed by Sisley and company, I think, is Go Micro.
So, this is a pluggable RPC framework which can also be used for microservices. So, we see here some of the features. You can do service discovery with it, log balancing, synchronous communication, asynchronous communication, different messaging encodings are supported, and client server RPC calls. Again, we will be using this in one of our later examples throughout this course. Another one is called Gizmo, initially developed by the New York Times.
Might also find this one helpful. See here some of the key features, standardized configuration of logging. They'll do provide health check endpoints. They have useful metrics endpoints, structured logging, graceful shutdowns. So, different things. They do provide publish/subscribe communication as well as synchronous communication. Without through the category of the web frameworks, one of the web frameworks this very, very popular is the Gorilla web toolkit.
It's kind of basic but still powerful. It does support RPC over HTTP with JSON-RPC encoded messages, and has a powerful URL router and dispatcher. It can convert form values to structs. And all this it operates on the standard HTTP module Go provides. So, it's kind of light weight. And last but not least, I want to introduce you to gin-gonic or the gin framework. So, this is a HTTP framework written in Go.
Supposedly, it's really fast. It's got smashing performance. So, you can try this yourself. Again here, quick start examples provided. Here are some basic performance comparisons. This is how I can use it. And we will use this framework in our next video coming up. So, in the next video, I will show you an advanced Go Microservice implementation using the gin framework.
I hope to see you then. Bye-bye.
This course was created and produced by Packt Publishing. We are honored to host this training in our library.
- Cloud native application platforms
- Go frameworks and libraries for microservices
- Using Docker for containerization
- Using Kubernetes for orchestration
- Using Consul for microservice discovery and configuration
- Registration and lookup
- Implementing service discovery using Kubernetes
- Microservice communication patterns: Sync and async
- Using circuit breakers for resilient communication
- Implementing message queuing with Rabbitmq
- Using Apache Kafka for publish/subscribe