close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2101

Table Of Contents

3.4.5 Enforcing an Execution Timeout for GraphQL Queries

As a last resort, it is possible to enforce a maximum time to process a GraphQL query. Whenever that time is exceeded, a timeout kicks in, aborting the query execution. As at this point of time the query was already invoked, this type of counter measure should be considered as a last resort. If the server is under such a high load, instead of enforcing an execution timeout, please consider counter measures outside of the Headless Server, as mentioned above. Besides, if there is no malicious attack, the server resources like the number of processors, or RAM size may be sized too small. In such cases, raising limited resources or deploying another instance of the Headless Server may be fitting solutions.

The timeout is implemented by the ExecutionTimeoutInstrumentation provided by CoreMedia and bundled with the Headless Server. It can be enabled by setting the configuration property caas.graphql.max-query-execution-time to a value greater than 0. The default value is 0 which means that no timeout is checked.

The timeout is set in milliseconds. A reasonable value may be 2000 or 3000 (that is, 2 or 3 seconds). Also keep in mind, that the first invocation of a query on a new instance of the Headless Server may take much longer than the follow-up queries due to caching effects.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.