简体   繁体   English

Express Gateway 降级导致请求出现巨大延迟

[英]Express Gateway degraded causing huge delays on requests

I have a Gateway configured to handle some services, but there is a huge performance issue and I don't know how can I address this.我有一个配置为处理某些服务的网关,但存在巨大的性能问题,我不知道如何解决这个问题。 This is the config for this particular service:这是此特定服务的配置:

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

Check on this gif so you can see how this is very bad on performance:检查此 gif,以便您了解这对性能的影响:

性能不佳的快速网关

And this is a call directly to the service API with no performance issue:这是对服务 API 的直接调用,没有性能问题:

无网关

Why is this happening?为什么会这样? What can I do to solve this issue?我能做些什么来解决这个问题?

Finally I couldn't use this anymore an move to do the proxy through Nginx directly.最后我不能再使用它直接通过 Nginx 进行代理了。 Any request made through the Gateway it took seconds almost minutes and now using Nginx as a gateway it takes miliseconds.通过网关发出的任何请求都需要几秒钟的时间,现在使用 Nginx 作为网关需要几毫秒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM