Kong网关在Kubernetes中的一些优化措施

在产品初始阶段,网关最初的选型是Kong,选择Kong的原因主要有以下几点

  • 1 Kong 就有良好的API,操作,应用服务可以自由的实现服务的注册.而不用运维参与
  • 2 Kong的本质依托于Nginx OpenRestry,性能是有保障的,基于Nginx的知识是基本可以平滑使用
  • 3 Kong提供易用的Dashboard的.操作起来较为容易.

2022年中的时候,因为业务需要,技术团队特此压测了几个主流的网关主要涉及以下

  • Kubernetes Ingress
  • Kong
  • API SIX

想看一下,在Kubernetes中基本相同的资源下,以上各个网关的表现水平,以便有个大致印象

除去配置HPA以为,还可以优化Kong的以下两个方面:

1 设置upstream的连接池大小

upstream_keepalive_pool_size

Sets the default size of the upstream keepalive connection pools.

Upstream keepalive connection pools are segmented by the dst ip/dst port/SNI attributes of a connection.

A value of 0 will disable upstream keepalive connections by default, forcing each upstream request to open a new connection.

Default: 60

2 设置upstream的最大连接数

upstream_keepalive_max_requests

Sets the default maximum number of requests than can be proxied upstream through one keepalive connection.

After the maximum number of requests is reached, the connection will be closed.

A value of 0 will disable this behavior, and a keepalive connection can be used to proxy an indefinite number of requests.

发表评论