Kong : A powerful alternative to AWS API gateway.

Problem/Use case :

I want to have an API management platform for microservices based enterprise level application which will take care of security, scalability, traffic management, high availability, rate limiting, routing and versioning etc.

Background :

Now a days microservices is become a buzzword. Applications are being built on microservices architecture because of its huge advantages. It’s not just the services, even the consumers of microservices are polyglot. Web applications built with latest JS frameworks such as AngularJS, Ember and Bootstrap; iOS and Android applications for mobile devices; and IoT applications consume the polyglot microservices. For all above the key enabler is the API layer that acts as the glue between the services and the consumers.

Hence API’s are becoming the core/integral part of architecture. There is special attention given to API layer from developers and architects as well by spending good amount of time to get it right at first place.

Solution :

There are so many players in the market like 3scale, apigeee, IBM bluemix, WSO2 api cloud but below are the 2 promising and dominant players in the market right now.

  1. AWS API Gateway :
  • Elastic and pay as you use model.
  • Integration with AWS lambda to create powerful serverless backend infrastructure.
  • Integration with IAM for security. Supports authentication and authorization for api’s.
  • Traffic management, throttling and monitoring support.

      2. Kong :

  • Open source and scalable.
  • Clustering support.
  • Supports authentication and authorization for api’s.
  • Monitoring, throttling, logging and rate limiting can be handled through plugins.
  • Platform agnostic.
  • Very strong Kong community.

So, Why Kong?

Although AWS api gateway gives easier way to developers to create/develop/deploy microservices but its has certain limitations.

The biggest limitation we face with AWS api getaway is, it doesn’t support gzip compression. So, in our case, where our backend web server apis returns response in megabytes and because of inability of api gateway to compress the response data, too much of time was spent over the wire resulting in the poor response time of apis.

Kong has compression support and what we achieved with Kong is reduction in response time by almost 50%.

Sounds good?

Out of curiosity, is there any way to still use AWS api gateway and with compression enabled?

Yes, you can if you doesn’t care for response time.(I guess, no one falls in this category.) We found out a hack to achieve this. As, AWS cloudfront supports gzip compression , what you can do is just create new cloudfront distribution and point it to your api gateway.(for those who are unaware, api gateway internally uses cloudfront). But again by the experience, this kind of setup incurs extra 2-3 seconds of addition time in your overall api response time.

References :

  1. https://getkong.org/ 
  2. https://aws.amazon.com/blogs/aws/new-gzip-compression-support-for-amazon-cloudfront/
  3. https://aws.amazon.com/api-gateway/
  4. https://aws.amazon.com/cloudfront/

One thought on “Kong : A powerful alternative to AWS API gateway.

Leave a comment