Skip to content

Commit

Permalink
deploy: 7b9738b
Browse files Browse the repository at this point in the history
  • Loading branch information
berkslv committed May 20, 2024
1 parent e78779e commit 7e47890
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,7 @@ What is an API Gateway? An API Gateway provides an entry point to our systems as
<h3 id="krakend">KrakenD</h3>
<p>KrakenD is an API gateway product developed with Go and has both community and enterprise versions. It runs on the Lura engine, which was donated to the Linux Foundation in 2021. Compared to other API gateway products, it offers a powerful aggregation system. You can perform all aggregation operations using only configuration files without writing any code.</p>
<p>Since KrakenD does not use a database, it does not create confusion when deciding on deployment options. We can perform our operations using only configuration files. However, it does not have an admin panel due to the lack of a database. The absence of a database eliminates additional error sources and provides easier scalability.</p>
<p>All configurations are managed through a configuration file that can be tracked</p>
<p>with git. It supports different file formats like JSON, YAML, and TOML. We can quickly create configurations using the interface on KrakenD’s website. In a local development environment, you can quickly start and make requests to your service, as it only works through the configuration file. With the hot reload feature, you can update the configuration file with a short downtime. However, this method is not recommended for production environments; using GitOps methods to create a new release is advised. The enterprise version includes additional features such as OpenAPI importer and exporter, gzip compression, and response validation.</p>
<p>All configurations are managed through a configuration file that can be tracked via version control systems such as Git. It supports different file formats like JSON, YAML, and TOML. We can quickly create configurations using the interface on KrakenD’s website. In a local development environment, you can quickly start and make requests to your service, as it only works through the configuration file. With the hot reload feature, you can update the configuration file with a short downtime. However, this method is not recommended for production environments; using GitOps methods to create a new release is advised. The enterprise version includes additional features such as OpenAPI importer and exporter, gzip compression, and response validation.</p>
<img src="https://berkselvi.dev/img/api-gateway-alternatives-from-a-net-developer-standpoint/krakend-designer.png" alt="KrakenD designer" loading="lazy" />
<br/>
<p>KrakenD has a much simpler Docker Compose content compared to Kong and APISIX, as it does not have any additional dependencies. You only need to provide the path to the configuration file as a volume. For example, I added the weather service to Docker Compose and quickly started the service by creating the krakend.json file. It gave very good results in the performance test.</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!doctype html><html lang=en><head><title>API Gateway Alternatives from a .NET Developer's Perspective: YARP, Ocelot, Kong, APISIX, and KrakenD :: Berk Selvi | Software Developer</title>
<meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="We explore API Gateway alternatives for .NET developers. Starting with .NET-based solutions like YARP and Ocelot, we evaluate OpenResty-based Kong and Apache APISIX as well as Go-based KrakenD. By detailing the features, performance, and use cases of each API Gateway, we aim to help you make the right choice."><meta name=keywords content="api gateway,yarp,ocelot,kong,apisix,krakend"><meta name=robots content="noodp"><link rel=canonical href=https://berkselvi.dev/posts/api-gateway-alternatives-from-a-net-developer-standpoint/><link rel=stylesheet href=https://berkselvi.dev/assets/style.css><link rel=stylesheet href=https://berkselvi.dev/assets/green.css><link rel=canonical href=https://berkselvi.dev/posts/api-gateway-alternatives-from-a-net-developer-standpoint/><link rel=apple-touch-icon sizes=57x57 href=/icon/apple-icon-57x57.png><link rel=apple-touch-icon sizes=60x60 href=/icon/apple-icon-60x60.png><link rel=apple-touch-icon sizes=72x72 href=/icon/apple-icon-72x72.png><link rel=apple-touch-icon sizes=76x76 href=/icon/apple-icon-76x76.png><link rel=apple-touch-icon sizes=114x114 href=/icon/apple-icon-114x114.png><link rel=apple-touch-icon sizes=120x120 href=/icon/apple-icon-120x120.png><link rel=apple-touch-icon sizes=144x144 href=/icon/apple-icon-144x144.png><link rel=apple-touch-icon sizes=152x152 href=/icon/apple-icon-152x152.png><link rel=apple-touch-icon sizes=180x180 href=/icon/apple-icon-180x180.png><link rel=icon type=image/png sizes=192x192 href=/icon/android-icon-192x192.png><link rel=icon type=image/png sizes=32x32 href=/icon/favicon-32x32.png><link rel=icon type=image/png sizes=96x96 href=/icon/favicon-96x96.png><link rel=icon type=image/png sizes=16x16 href=/icon/favicon-16x16.png><link rel=manifest href=/icon/manifest.json><meta name=msapplication-TileColor content="#1D1E28"><meta name=msapplication-TileImage content="/icon/ms-icon-144x144.png"><meta name=theme-color content="#1D1E28"><meta name=twitter:card content="summary"><meta name=twitter:site content><meta name=twitter:creator content="berkslv"><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="og:title" content="API Gateway Alternatives from a .NET Developer's Perspective: YARP, Ocelot, Kong, APISIX, and KrakenD"><meta property="og:description" content="We explore API Gateway alternatives for .NET developers. Starting with .NET-based solutions like YARP and Ocelot, we evaluate OpenResty-based Kong and Apache APISIX as well as Go-based KrakenD. By detailing the features, performance, and use cases of each API Gateway, we aim to help you make the right choice."><meta property="og:url" content="https://berkselvi.dev/posts/api-gateway-alternatives-from-a-net-developer-standpoint/"><meta property="og:site_name" content="Berk Selvi | Software Developer"><meta property="og:image" content="https://berkselvi.dev/icon/favicon.ico"><meta property="og:image:width" content="2048"><meta property="og:image:height" content="1024"><meta property="article:published_time" content="2024-05-20 00:00:00 +0300 +0300"><link href=https://berkselvi.dev/css/custom.css rel=stylesheet></head><body class=green><div class="container center headings--one-size"><header class=header><nav class=menu><ul class="menu__inner menu__inner--desktop"><li><a href=/>home</a></li><div class=spacer></div><ul class=language-selector><ul class=language-selector-current><li>english ▾</li></ul><ul class="language-selector__more hidden"><li><a href=https://berkselvi.dev/>english</a></li><li><a href=https://berkselvi.dev/tr/>türkçe</a></li></ul></ul></ul><ul class="menu__inner menu__inner--mobile"><li><a href=/>home</a></li><hr><li><a href=https://berkselvi.dev/>english</a></li><li><a href=https://berkselvi.dev/tr/>türkçe</a></li></ul></nav></header><div class=content><div class=post><h4>For turkish translation;</h4><a href=/tr/posts/api-gateway-alternatives-from-a-net-developer-standpoint/>.NET Geliştiricisi Perspektifinden API Gateway Alternatifleri: YARP, Ocelot, Kong, APISIX ve KrakenD</a><h1 class=post-title><a href=https://berkselvi.dev/posts/api-gateway-alternatives-from-a-net-developer-standpoint/>API Gateway Alternatives from a .NET Developer&rsquo;s Perspective: YARP, Ocelot, Kong, APISIX, and KrakenD</a></h1><div class=post-meta><span class=post-date>May 20, 2024
</span><span class=post-author>:: Berk Selvi</span>
<span class=post-reading-time>:: 19 min read (3943 words)</span></div><div class=post-content><div><p>We can use API Gateway services as an intermediary layer while exposing our services to the outside world in microservice architecture. In this article, we will briefly discuss what an API Gateway is and then talk about .NET, OpenResty, and Go-based API Gateway alternatives along with performance tests.</p><h2 id=what-is-an-api-gateway>What is an API Gateway?<a href=#what-is-an-api-gateway class=hanchor arialabel=Anchor>&#8983;</a></h2><p>An API Gateway provides an entry point to our systems as shown below, isolating them from the outside world. It solves common issues such as authorization, logging, and rate limiting with a single service that would otherwise need to be implemented repeatedly in each sub-service.</p><p>They can apply transformations to URLs, body information, and even protocols while routing requests. For example, an HTTP request can be transmitted to sub-services using the gRPC protocol for better performance. They can use flat files or databases to find the addresses of the services they will route incoming requests to.</p><img src=/img/api-gateway-alternatives-from-a-net-developer-standpoint/what-is-api-gateway.png alt="What is API Gateway" loading=lazy><br><h2 id=what-are-the-alternatives>What are the alternatives?<a href=#what-are-the-alternatives class=hanchor arialabel=Anchor>&#8983;</a></h2><p>When evaluating API Gateway alternatives that we can use in our systems, we need to consider the required customization, performance, suitability for distributed architecture, and the ability to update route information via an admin panel. Unfortunately, there is no single gateway product that meets all these features and solves all our needs at once. We need to make these evaluations based on the specific needs of our system.</p><p>First, we will examine the .NET-based YARP and Ocelot API gateway products, which can be customized with C#, then talk about Kong and Apache APISIX, which use the OpenResty (nginx and lua) combination. Finally, we will look at KrakenD, which is frequently used in cloud-native environments and developed with Go. All these options can be used open source for free, but we can get enterprise support for Kong, Apache APISIX, and KrakenD if needed.</p><p>Before evaluating our options, I developed a very simple .NET API service that simulates database queries by waiting for 1 second. After putting this service behind the API Gateway, we will try to route requests and perform performance tests using the Apache Benchmark tool. To examine resource consumption more closely, we will run this application with other gateways using docker compose and receive responses from the service at service:8080.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-csharp data-lang=csharp><span style=display:flex><span><span style=color:#75715e>// Program.cs</span>
<span class=post-reading-time>:: 19 min read (3948 words)</span></div><div class=post-content><div><p>We can use API Gateway services as an intermediary layer while exposing our services to the outside world in microservice architecture. In this article, we will briefly discuss what an API Gateway is and then talk about .NET, OpenResty, and Go-based API Gateway alternatives along with performance tests.</p><h2 id=what-is-an-api-gateway>What is an API Gateway?<a href=#what-is-an-api-gateway class=hanchor arialabel=Anchor>&#8983;</a></h2><p>An API Gateway provides an entry point to our systems as shown below, isolating them from the outside world. It solves common issues such as authorization, logging, and rate limiting with a single service that would otherwise need to be implemented repeatedly in each sub-service.</p><p>They can apply transformations to URLs, body information, and even protocols while routing requests. For example, an HTTP request can be transmitted to sub-services using the gRPC protocol for better performance. They can use flat files or databases to find the addresses of the services they will route incoming requests to.</p><img src=/img/api-gateway-alternatives-from-a-net-developer-standpoint/what-is-api-gateway.png alt="What is API Gateway" loading=lazy><br><h2 id=what-are-the-alternatives>What are the alternatives?<a href=#what-are-the-alternatives class=hanchor arialabel=Anchor>&#8983;</a></h2><p>When evaluating API Gateway alternatives that we can use in our systems, we need to consider the required customization, performance, suitability for distributed architecture, and the ability to update route information via an admin panel. Unfortunately, there is no single gateway product that meets all these features and solves all our needs at once. We need to make these evaluations based on the specific needs of our system.</p><p>First, we will examine the .NET-based YARP and Ocelot API gateway products, which can be customized with C#, then talk about Kong and Apache APISIX, which use the OpenResty (nginx and lua) combination. Finally, we will look at KrakenD, which is frequently used in cloud-native environments and developed with Go. All these options can be used open source for free, but we can get enterprise support for Kong, Apache APISIX, and KrakenD if needed.</p><p>Before evaluating our options, I developed a very simple .NET API service that simulates database queries by waiting for 1 second. After putting this service behind the API Gateway, we will try to route requests and perform performance tests using the Apache Benchmark tool. To examine resource consumption more closely, we will run this application with other gateways using docker compose and receive responses from the service at service:8080.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-csharp data-lang=csharp><span style=display:flex><span><span style=color:#75715e>// Program.cs</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>var</span> builder = WebApplication.CreateBuilder(args);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>builder.Services.AddEndpointsApiExplorer();
Expand Down Expand Up @@ -322,7 +322,7 @@
</span></span><span style=display:flex><span> 98% <span style=color:#ae81ff>1047</span>
</span></span><span style=display:flex><span> 99% <span style=color:#ae81ff>1327</span>
</span></span><span style=display:flex><span> 100% <span style=color:#ae81ff>3378</span> <span style=color:#f92672>(</span>longest request<span style=color:#f92672>)</span>
</span></span></code></pre></div><h2 id=go-based-alternatives>Go Based alternatives<a href=#go-based-alternatives class=hanchor arialabel=Anchor>&#8983;</a></h2><p>As a Go-based API Gateway alternative, we will discuss KrakenD, the most prominent option. However, Tyk or Traefik API Gateway can also be preferred as secondary alternatives with Go, but they are not included in this narrative as I could not try them since they are paid.</p><h3 id=krakend>KrakenD<a href=#krakend class=hanchor arialabel=Anchor>&#8983;</a></h3><p>KrakenD is an API gateway product developed with Go and has both community and enterprise versions. It runs on the Lura engine, which was donated to the Linux Foundation in 2021. Compared to other API gateway products, it offers a powerful aggregation system. You can perform all aggregation operations using only configuration files without writing any code.</p><p>Since KrakenD does not use a database, it does not create confusion when deciding on deployment options. We can perform our operations using only configuration files. However, it does not have an admin panel due to the lack of a database. The absence of a database eliminates additional error sources and provides easier scalability.</p><p>All configurations are managed through a configuration file that can be tracked</p><p>with git. It supports different file formats like JSON, YAML, and TOML. We can quickly create configurations using the interface on KrakenD&rsquo;s website. In a local development environment, you can quickly start and make requests to your service, as it only works through the configuration file. With the hot reload feature, you can update the configuration file with a short downtime. However, this method is not recommended for production environments; using GitOps methods to create a new release is advised. The enterprise version includes additional features such as OpenAPI importer and exporter, gzip compression, and response validation.</p><img src=/img/api-gateway-alternatives-from-a-net-developer-standpoint/krakend-designer.png alt="KrakenD designer" loading=lazy><br><p>KrakenD has a much simpler Docker Compose content compared to Kong and APISIX, as it does not have any additional dependencies. You only need to provide the path to the configuration file as a volume. For example, I added the weather service to Docker Compose and quickly started the service by creating the krakend.json file. It gave very good results in the performance test.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span>{
</span></span></code></pre></div><h2 id=go-based-alternatives>Go Based alternatives<a href=#go-based-alternatives class=hanchor arialabel=Anchor>&#8983;</a></h2><p>As a Go-based API Gateway alternative, we will discuss KrakenD, the most prominent option. However, Tyk or Traefik API Gateway can also be preferred as secondary alternatives with Go, but they are not included in this narrative as I could not try them since they are paid.</p><h3 id=krakend>KrakenD<a href=#krakend class=hanchor arialabel=Anchor>&#8983;</a></h3><p>KrakenD is an API gateway product developed with Go and has both community and enterprise versions. It runs on the Lura engine, which was donated to the Linux Foundation in 2021. Compared to other API gateway products, it offers a powerful aggregation system. You can perform all aggregation operations using only configuration files without writing any code.</p><p>Since KrakenD does not use a database, it does not create confusion when deciding on deployment options. We can perform our operations using only configuration files. However, it does not have an admin panel due to the lack of a database. The absence of a database eliminates additional error sources and provides easier scalability.</p><p>All configurations are managed through a configuration file that can be tracked via version control systems such as Git. It supports different file formats like JSON, YAML, and TOML. We can quickly create configurations using the interface on KrakenD&rsquo;s website. In a local development environment, you can quickly start and make requests to your service, as it only works through the configuration file. With the hot reload feature, you can update the configuration file with a short downtime. However, this method is not recommended for production environments; using GitOps methods to create a new release is advised. The enterprise version includes additional features such as OpenAPI importer and exporter, gzip compression, and response validation.</p><img src=/img/api-gateway-alternatives-from-a-net-developer-standpoint/krakend-designer.png alt="KrakenD designer" loading=lazy><br><p>KrakenD has a much simpler Docker Compose content compared to Kong and APISIX, as it does not have any additional dependencies. You only need to provide the path to the configuration file as a volume. For example, I added the weather service to Docker Compose and quickly started the service by creating the krakend.json file. It gave very good results in the performance test.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#f92672>&#34;$schema&#34;</span>: <span style=color:#e6db74>&#34;https://www.krakend.io/schema/krakend.json&#34;</span>,
</span></span><span style=display:flex><span> <span style=color:#f92672>&#34;version&#34;</span>: <span style=color:#ae81ff>3</span>,
</span></span><span style=display:flex><span> <span style=color:#f92672>&#34;name&#34;</span>: <span style=color:#e6db74>&#34;KrakenD - API Gateway&#34;</span>,
Expand Down
Loading

0 comments on commit 7e47890

Please sign in to comment.