How to optimize get helper and reduce TTFB

I am working on a large ghost instance with 5000+ articles and use the following ghost version:
Ghost-CLI version: 1.13.1
Ghost version: 2.37.2

I keep getting logs such as:

[2019-12-28 20:33:31] WARN
NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 241ms to complete
level: normal
ERROR DETAILS:
    {"api":"v2.postsPublic.browse","apiOptions":{"limit":"3","filter":"tags:javascript+id:-5ceb78c9e17b4228e018650b"},"returnedRows":3}

Which are originated from get helpers similar to the ones used in the default casper theme

{{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{comment_id}}" limit="3" as |related_posts|}}

That being said, the load on any of our resources such as Nginx, db, etc seems to be normal.

Not sure if it is related but TTFB has dramatically increased and performance has been affected as a result.

I was wondering if there is a way to optimize get helper queries and/or improve performance for this particular case.

live site
theme-repo
additional config

Thank you.

Hey @ahmadabdolsaheb :wave: The 241ms timing showed in the logs is definitely not the best performance, but should not be causing huge degradation in TTFB all of the sudden. One reason why it might be problematic is when a similar query is executed repeatedly during a single page load (for example in a loop).

Don’t see anything out of ordinary with the query itself. Think we’d need a little more debugging to narrow down the root of the issue. What were the timings in the Nginx logs for the long TTFB requests? Did you notice any spikes in the hosting server’s CPU, memory or disk i/o? Can you pinpoint the slowdown to any specific change on your side, e.g.: Ghost version update, configuration change in Nginx?

Thank you for your response @gargol. Although we checked all of the above scenarios and could not find any irregularity, we were able to resolve this issue by changing our architecture. I will update this post with more details once our postmortem is finalized.