KrakenD is a pure API Gateway that interacts with all your different micro services providing clients a single interface and has become a standard for building micro services. With micro services mushrooming all over the place, there has been a lot of demand in designing a stable API Gateway. There are many open source and enterprise version gateways available in market. In terms of open source, Ocelot, Kong, Tyk are few of the popular gateways. HAProxy which was typically a reverse and forward proxy is now capable of carrying out API Gateway responsibilities.
We explored quite a few opensource API gateways before finalizing on KrakenD. I am going to talk about top 5 reasons why we picked KrakenD
Stateless and No Databases
Most of the API gateways required node coordination or centralization. Which means there could be single point of failures if the coordinators got down or the database that carries coordination metadata does down. What we liked in KrakenD cluster is all nodes are autonomous and can keep running even if any (or) all other nodes are down.
Exceptional throughput
If you explore a bit more, KrakenD has been coded in Go. And looks like they have just used just the standard libraries and no other dependencies. In fact it shows just incase you carry out a stress test, which I strongly recommend. If you don’t have enough time to perform a full blown performance test, here is the benchmark results published by KrakenD.
JWT Authorization with external service
In most of the opensource API gateways, I find that some of the critical components that are required if you are running in production is not opensource. For instance Kong doesn’t give you plugin to verify requests containing HS256 or RS256 signed JSON Web Token against external OAuth providers as part of their opensource framework. Whereas in KrakenD you can enable this using a validator plugin.
Service Discovery
Another important feature that is required when it comes to production deployment is service discovery of your API’s. You might have multiple servers hosting your api’s and during auto scaling the servers list might be dynamic. Having service discovery feature as part of the any API gateway a must have. KrakenD provides the following ways to configure your service discovery services
- Static address resolution
- etcd
- DNS SRV (e.g: k8s)
- Custom service discovery
Online API Gateway Designer
KrakenD provides an out-of-the-box visual editor for the managing your configuration file. This is kind of really handy as one need not figure out what to configure where. The editor is kind of neat and modularized, so you can pick and choose what feature to enable and finally export the configuration file.
Missing Feature — Hitless / Hot Reloads
What is hitless reload? As quoted by HAProxy
What users often call a “seamless” or “hitless” reload is a configuration update or a service upgrade performed with no impact on user experience.
Configuration updates may require a stop/start sequence of certain services, causing temporary outages and making the admins worry a lot before performing them or trying to postpone them for as long as possible. With today’s microservices and very frequent reloads, it is not acceptable that any single connection is lost during a configuration update or a service upgrade
Currently KrakenD does not support hitless or hot reloads because of performance reason. There is a blog post on why KrakenD still does not support hitless reloads. However we did come up with a solution for hot reload for production.
Hitless reload of KrakenD using HAProxy & Data Plane API
A workaround to achieve hitless reloads of KrakenD: is to install a clustered KrakenD gateways and configure all the gateway in HAProxy as backend. During deployment, we would use Data plane API to remove the gateway server one at a time, upgrade the gateway and move it in to the mix (or) create a new set of gateways with new package and add it in to the mix and remove the old ones.
Summary
KrakenD is a terrific API gateway that interacts with all your different micro services providing clients a single interface and has become a standard for building micro services. With micro services mushrooming all over the place, there has been a lot of demand in designing a stable API Gateway. From what we have seen, pretty sure KrakenD is going to become an important player in API gateway space. Based on open source community feedback and usage, I hope they will keep adding more features and support for a feature rich community edition as well.
所有评论(0)