我配置了一个网关来处理一些服务,但是有一个巨大的性能问题,我不知道如何解决这个问题。这是此特定服务的配置:
http:
port: 3020
hostname: 'xxxx.prod.xx.xxx.net'
apiEndpoints:
laPrdTest:
host: 'xxx-xxxxxxxx.xxxxxxxx.com'
paths: '/api/v1/esign/*'
serviceEndpoints:
laPrdTest:
urls:
- http://xxxxxx-app1.prd.xxx.xxxxxxxx.net
- http://xxxxxx-app2.prd.xxx.xxxxxxxx.net
policies:
- basic-auth
- cors
- expression
- log
- jwt
- proxy
- rate-limit
pipelines:
laPrdTest:
apiEndpoints:
- laPrdTest
policies:
- cors:
- log:
- action:
message: ${req.method} ${req.originalUrl} ${JSON.stringify(req.headers)}
- rate-limit:
- action:
max: 50
windowMs: 120000
rateLimitBy: "${req.ip}"
- proxy:
- action:
serviceEndpoint: laPrdTest
changeOrigin: true请查看此gif,以便您可以看到这对性能有多糟糕:

这是对服务API的直接调用,没有性能问题:

为什么会发生这种情况?我能做些什么来解决这个问题?
发布于 2021-07-15 03:57:22
最后,我不能再使用这个方法了,直接通过Nginx来做代理。通过Gateway发出的任何请求都需要几秒钟,几乎是几分钟,现在使用Nginx作为网关需要几毫秒。
https://stackoverflow.com/questions/63723869
复制相似问题