Increased TTFB issue

Since 15th May 2020 we face increased TTFB when the client is calling netlify function endpoint for data.
In short the app calling the netlify function that query data from a DB hosted in the same AWS region.

Site name: app-brightmeup-ai
Domain is: app.brightmeup.ai

We see 2sec TTFB in the dev console:

At the functions log we see around 100ms execution time:
10:57:13 AM: [GIN] 2020/06/10 - 08:57:13 | 200 | 115.510045ms | 195.38.119.54 | GET /.netlify/functions/avatar/available?engineId=fintechNews
10:57:13 AM: Duration: 137.60 ms Memory Usage: 53 MB Init Duration: 135.49 ms
10:58:02 AM: [GIN] 2020/06/10 - 08:58:02 | 200 | 141.164154ms | 195.38.119.54 | GET /.netlify/functions/avatar/available?engineId=fintechNews
10:58:02 AM: Duration: 168.26 ms Memory Usage: 55 MB
10:58:33 AM: [GIN] 2020/06/10 - 08:58:33 | 200 | 74.53415ms | 195.38.119.54 | GET /.netlify/functions/avatar/available?engineId=fintechNews
10:58:33 AM: Duration: 95.74 ms Memory Usage: 57 MB

Full page loading HAR file: https://drive.google.com/file/d/1TRSQxgzskyqxINPgEJ--fiYGY_e7V2mc/view?usp=sharing

Has anyone encountered a similar problem?

Hi there & welcome to our community!

I just took a look at our internal logs and see a really steady average time for function calls from our server’s point of view over the past 30 days which is as far back as our logs go: 1328ms

Running the function is only a small part of the runtime - from your HAR file we can see that this request came from Hungary, went to our CDN node in Frankfurt, which reverse proxy’d the request to the US where we run functions (what region is your database in?), and then the response was proxy’d back to Frankfurt, and sent from there to your browser.

I think that a second or two is normal for this request path. I’m curious what you were seeing in the past?

Hello!

Thank you for your reply.

Our motivation to ask this on the forum was driven by our clients whose saying that one of our application page did perform faster in the past. The effect of this slow request right now can be seen on the user interface because when the data arrives the whole component re-renders…

We have digged deeper on of our logging tool and we have found out that you are right!
This request was perform the same in the past but we unfortunately implemented a UI feature that make this effect more visible.

Now we know what to do to solve the problem.

Thank you for your help!

Negentropics Dev Team