api3dao / airnode

Airnode monorepo
https://docs.api3.org/
MIT License
166 stars 72 forks source link

HTTP gateway times out at cold starts #1386

Open bbenligiray opened 2 years ago

bbenligiray commented 2 years ago

Signed HTTP gateway calls consistently time out at cold starts. This is noteworthy because a cold start supposedly adds 100-1000 ms, while the gateway time out at 5000 ms and the remaining 4000 ms should be more than enough for the external API call and additional processing. I'm reporting this as a thing to investigate whenever someone has time. My suspicion is that after reducing the memory to 128 MB, our cold starts become a lot slower than the usual 100-1000 ms. This is not an issue for Airseeker, as the next batch of calls tend to go through no problem.

Note: This may only apply to the signed gateway, I don't use the other one. However, it was reported to happen at least once with the regular gateway here.

Siegrift commented 2 years ago

This was already raised internally here

bbenligiray commented 2 years ago

I was hoping that https://github.com/api3dao/airnode/issues/1186 would address this back then

aquarat commented 2 years ago

Possibly fixed by increases in timeouts in @amarthadan 's recent bucket fix PR: https://github.com/api3dao/airnode/pull/1424 (which extended the timeouts).

Siegrift commented 2 years ago

Nope, it doesn't. I experienced this issue while testing the PR.

aquarat commented 2 years ago

I noticed when I was trying to identify Airnode timeouts with large config files that reading and parsing the config has an impact on start time (the parsed config is stored in a global variable after the first run). This may be an avenue worth pursuing for investigation. I'm not sure how we'd deal with it if it is indeed config loading and parsing.