Slow_get_helper

Using the command ghost log -n 200 I get the following error messages:


NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 273ms to complete

level: normal

ERROR DETAILS:
    {"api":"tagsPublic.browse","apiOptions":{"limit":"6","order":"count.posts desc","include":"count.posts","context":{"member":null}},"returnedRows":6}


[2022-08-20 14:57:23] WARN

NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 211ms to complete

level: normal

ERROR DETAILS:
    {"api":"tagsPublic.browse","apiOptions":{"limit":"5","order":"count.posts desc","include":"count.posts","context":{"member":null}},"returnedRows":5}


[2022-08-20 14:57:23] INFO "GET /url/" 200 368ms
[2022-08-20 14:57:23] WARN

NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 253ms to complete

level: normal

ERROR DETAILS:
    {"api":"postsPublic.browse","apiOptions":{"filter":"id:-603a63cfc4a317760b008a1f+tag:hash-es","limit":"3","include":"tags,authors","context":{"member":null}},"returnedRows":3}

I don’t understand how to solve them, some indications?

Are you running the latest version of Ghost? Please share details of your setup, including platform and software versions, and maybe what data are fetched using get.

Moreover, note that this is a warning and highlighting that your use of the get helper might impede page load times.

Hi thanks for your reply,
in fact I often notice that some pages load very slowly.

I use ghost latest version.
Ubuntu 18.04
Node 14.16.1

1 Like

Have you been able to troubleshoot this? Getting the same error

1 Like

No I didn’t solve it, unfortunately I didn’t have time to deal with it.
I still encounter SLOW_GET_HELPER.
I just noticed that I have additional errors in the ghost log output:

[2022-10-18 13:23:51] ERROR "GET / ghost / api / admin / users / me /" 403 2ms

NAME: NoPermissionError
MESSAGE: Authorization failed

level: normal

"Unable to determine the authenticated user or integration. Check that cookies are being passed through if using session authentication."
NoPermissionError: Authorization failed
...

[2022-10-18 13:23:51] INFO "GET / slug-post /" 200 265ms
[2022-10-18 13:23:56] ERROR

NAME: BadRequestError
MESSAGE: Error parsing filter

level: normal

Error: Query Error: unexpected character in filter at char 31
    at Child.applyDefaultAndCustomFilters (/var/www/name/versions/5.19.0/node_modules/@tryghost/bookshelf-filter/lib/bookshelf-filter.js:66:23)
... 0a6ba1bf6ff6315+tag:+tag:-hash-es) + type:
----------------------- ^
Expecting 'NOT', 'LBRACKET', 'NULL', 'TRUE', 'FALSE', 'NUMBER', 'NOW', 'LITERAL', 'STRING', 'CONTAINS', 'STARTSWITH', 'ENDSWITH', ' GT ',' LT ',' GTE ',' LTE ', got' AND '

...

The SLOW_GET_HELPER log warnings are what they sound like: The get helpers are slow. In terms of a “fix”, well, it depends on whether you think the problem is the performance is too slow or that the performance is OK and the logging is too noisy.

Performance

Assuming that Ghost is well-tuned and your Ghost database isn’t huge, the problem is that your underlying hardware or VPS is slow. Maybe you are running some other things on the server that are interfering. Maybe you are renting a server with “burstable” CPU, so you are only allowed so much “fast” CPU per hour. In any case, this is a “why is my server slow?” question and not a Ghost-specific question.

In my case, my VPS has a single, shared CPU so this could be a “noisy neighbor” problem where another tenant on the same host is hogging the CPU for a minute!

Logging

The threshold for what is considered “slow” is defined in the config file. You may have a config.production.json file. The related section is under logging:

  "slowHelper": {
            "level": "warn",
            "threshold": 200
        }

If you accept that your server is smaller and slower, you can adjust this threshold to reduce the log noise. You can check the times for these slow requests like this:

journalctl -e -n 20000 | grep 'helper took'

In my case, I see that most of my slow requests take less than 500ms. If that’s acceptable, I could tune logging.slowHelper.threshold to 500.

But these are in fact pretty slow requests between a web server and a small database on the same server, so I’m also tempted to review what it costs to upgrade my VPS!