tech-tip

This article is an effort to summarize the Top Microservices Frameworks in Go. Considering the flexibility in MSA (Microservices Architecture), these are not mutually exclusive and you can choose as per your architectural requirements, business need, organizational context, and other factors under consideration. Modern cloud-native architecture can use multiple frameworks in the same organization to develop different microservices.

As per Go’s naming conventions, these frameworks can be referred to as packages as well (used interchangeably in this article). Also, as Go has been designed to be a modern language — there are scenarios where you don’t need a package or framework as you can leverage standard packages (such as net/http).

Please note that these are listed in no particular priority order — the recommendation is to use the context-based decision to select a framework from Go or any other language.

#1 — Gin Web Framework

Gin is a high-performance web framework with a wide variety of middleware components, and growing community support for building Microservices.
Website: GitHub Stars: ~69K. Used by: ~116K.
(as of Mar 2023)

Companies using: ZestMoney, Fn Project, PhotoPrism, and dKron.

Key features:

  • High performance: Radix tree-based routing with a small memory footprint (Gin uses a custom version of HttpRouter). It supports a reflection approach, zero allocation router, and predictable API performance are key highlights from a performance perspective. Click here to see the detailed benchmark report.
  • Middleware support: It has an extensible middleware with an out-of-the-box chain of middleware covering different aspects (see the list here) such as Routing, CORS, GZip, Authorization, Tracing, Cache, Session, Logging, Timeout, JSON validation, etc.
  • Resiliency: Gin is crash-free increasing the resiliency of the application — it can catch a failure during an HTTP request and recover it gracefully.
  • Cloud support: While it can be deployed to any Cloud considering its lightweight nature — it has specific deployment support for Google App Engine, Render, Qovery, and Koyeb.
  • Vendor support: Considering its popularity, well supported by vendors. Examples such as Airbrake, New Relic, Sentry,  
  • Click here to read about the complete list of features and click here for code examples.

Suitable Scenarios:

  • Microservices with extensible support for middleware (capability to add more features).
  • Lightweight and high-performance (up to 40 times faster) with Martini-like API (Martini is archived now, which was inspired by ExpressJS).

#2 — Go kit (a toolkit for Microservices)

Go kit is a toolkit (similar to Spring Boot, Dropwizard in Java, or React in TypeScript) for building RPC-style Microservices with minimal opinionated views considering interoperability since inception.

Website: GitHub Stars: ~25K.
(as of Mar 2023)

Key features:

  • Interoperability: Easy to exchange information with non-Go components with respect to services (applying SOA approach). One of the goals is to operate within existing infrastructures — no mandates for specific tools or technologies.
  • Library for common concerns: RPC safety, system observability, infrastructure integration, and program design.
  • Pluggable approach: for serialization (JSON) and transport.

Suitable Scenarios:

  • RPC-style Microservices Development — not suitable for other messaging patterns.
  • Lightweight interoperable library for common application concerns
  • Not suitable for systems requiring opinionated view on operational concerns such as deployment, configuration, process supervision, orchestration, etc.

#3 — Go Restful

Go Restful (created by Ernest Micklei, a Google Developer) is a popular package for building REST-style web services in Go and can easily be used for REST-oriented Microservices.

Website: GitHub Stars: ~5K. Used by: ~15K.
(as of Mar 2023)

Key features:

  • Simple and customizable package for router algorithm, resiliency, compression, encoding, observability, and more.
  • Support for OpenAPI with extension (click here to know more) with Swagger UI support built-in.
  • Additional features such as customizable routers, encoders, loggers, tracers, compression providers, CORS handlers, and more.

Suitable Scenarios:

  • RPC-style Microservices Development — not suitable for other messaging patterns.
  • Extensible features with inbuilt OpenAPI support

#4 — FastHTTP

FastHTTP was designed for some high-performance edge cases. It is tuned for high performance, zero memory allocations in hot paths, and up to 10x faster than net/http.

Website: GitHub Stars: ~5K.
(as of Mar 2023)

Suitable Scenarios:

  • Only suitable for handling thousands of small to medium requests per second and needs a consistently low millisecond response time otherwise net/http should be preferred.

Other Key Frameworks

  • Martini — a powerful web framework (inspired by Express JS) but no longer maintained.
  • Gorilla Mux — a convenient HTTP router and matcher but no longer maintained (archived on Dec 2022).
  • Go Restful — package for building REST-style Web Services using Go.
  • Go Fiber — An Express-inspired web framework written in Go.
  • Beego — a high-performance web framework for the Go programming language.
  • Echo — a high-performance, minimalist Go web framework.
  • Kratos — Go microservices framework for the cloud-native era.
  • Revel — A flexible web framework for the Go language.
  • Goa — design-based APIs and microservices in Go.

Go Frameworks and usage across popular technologies

Top Microservices Frameworks in Go
Go Frameworks/Libraries
https://gist.github.com/ankurkumarz/32be8291b4dcb583511eda173ab5302f

References

Related Articles

Leave a Comment