amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

Amplify seems to add a large amount of delay to reverse proxy requests

Open boatcoder opened this issue 4 years ago • 5 comments

Before opening, please confirm:

Describe the bug

When not using Amplify (using separate nginx hosted react front end, my backend responds in 18.2 seconds for a large set of data. When using Amplify for the exact same data, to the exact same backend, the response exceeds 30 seconds and of course Amplify kills the request and returns a 502. What is amplify doing to extend this 18 second response past the 30 second mark.

Expected behavior

i expect an 18 second response, not a 12+ second delay. This started out as #1171 to control the reverse proxy timeout, but if Amplify is going to add 12 seconds to everything then amplify will not be usable as a product.

Reproduction steps

Open our NOT amplify version and load the page. 18 seconds from nothing to done Open our amplify version of the same page (same JS, same backend as above) more than 30s (and then the connection is 502'd) Exact same backend URL used in both cases. One is handled via nginx reverse proxy, one is handled by amplify.

Build Settings

[
    {
        "source": "/api/v3/<*>",
        "target": "elements-api.humanyze.com/api/v3/<*>",
        "status": "200",
        "condition": null
    },
    {
        "source": "/<*>",
        "target": "/index.html",
        "status": "404-200",
        "condition": null
    },
    {
        "source": "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>",
        "target": "/index.html",
        "status": "200",
        "condition": null
    }
]

This is the Amplify version of the API access https://user-images.githubusercontent.com/18578897/113328420-e0198d80-92e1-11eb-854f-b9cd657744a8.mp4

This is the NON-Amplify version of the same API Access https://user-images.githubusercontent.com/18578897/113334013-c596e280-92e8-11eb-807d-8eb64383be88.mp4

boatcoder avatar Apr 01 '21 17:04 boatcoder

4 days and not even an acknowledgement of this show stopper :-(. I guess I should just give up on being able to use Amplify.

boatcoder avatar Apr 05 '21 21:04 boatcoder

Hi @boatcoder, apologies for the delay. Sorry to hear that this has been a blocker.

Are you able to share any additional details of the API, as well as whether or not the NGINX based instance happens to be geographically isolated/separated from where you're making requests to the Amplify app. Wondering if a combination of the reverse proxy lookup roundtrip + the ~18-25 seconds of API processing is causing the timeout.

If you're not comfortable sharing it here you can send it to [email protected] - please include this GitHub issue (https://github.com/aws-amplify/amplify-console/issues/1719) so we know it's you!

Also, linking your other feature-request(https://github.com/aws-amplify/amplify-console/issues/1711) here for future tracking.

siegerts avatar Apr 07 '21 03:04 siegerts

My API is running in us-east-1c. I'll send the rest of the details via email.

boatcoder avatar Apr 12 '21 14:04 boatcoder

Hi @boatcoder I looked into what is going on. We actually set the origin read timeout to 15 seconds on reverse proxy requests and have a 30 second timeout on the distribution. So what is happening is the first request times out, it starts a second request and then hits the 30 second distribution timeout. If you look in your api logs, you should see 2 requests. We can take increasing the timeout on reverse proxy requests as a feature request.

behrooziAWS avatar Apr 14 '21 21:04 behrooziAWS

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

github-actions[bot] avatar Mar 07 '24 17:03 github-actions[bot]

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar Jun 26 '24 09:06 github-actions[bot]

This issue has been automatically locked.

github-actions[bot] avatar Jun 26 '24 10:06 github-actions[bot]