What
Virtuoso configuration file parameters to limit the number of triples in read/write SPARQL queries executed against the RDF Quad Store.
Why
A Virtuoso server can be accidentally or intentionally over loaded with the SPARQL query requests due to limited available system resources ie memory and CPUs, requiring a need to limit the number of triples that can be requested per query to protect it.
How
The number of triples a SPARQL query can generate for processing in the Virtuoso RDF Quad Store can be limited by two parameters in the [SPARQL]
section of the Virtuoso configuration file (virtuoso.ini
):
ResultSetMaxRows - Has always existed for limiting the number of triples a SPARQL query can generate for processing in the Virtuoso RDF Quad Store. This parameter is always used to limit the result set size of SPARQL SELECT
queries. Virtuoso uses an internal construct
call for generating a DICT
of triples for use in read CONSTRUCT/DESCRIBE and write INSERT/DELETE queries for adding or removing triples to/from graphs based on bindings for a query pattern specified in a WHERE
clause, which this parameter limits the size of. However, in some cases users want the read and write restrictions to have different limits, resulting in an additional configuration file parameter MaxConstructTriples
being introduced.
MaxConstructTriples - This parameter limits the size of the DICT
of triples generated by the internal construct
call for use in CONSTRUCT/DESCRIBE and INSERT/DELETE queries for adding or removing triples to/from graphs based on bindings for a query pattern specified in a WHERE
clause. When the limit is exceeded the following error is returned to notify the user the query could not be executed due to the limit:
Virtuoso 42000 Error D1CTX: Hash dictionary is full, exceeded XXXXX entries
If MaxConstructTriples
is not set, the original ResultSetMaxRows
is used as a fallback. A MaxConstructTriples
setting of 0
means unlimited ie there is no limit on DICT size which is then restricted by the available system memory resources.
Example configuration file settings:
[SPARQL]
ResultSetMaxRows = XXXXX
MaxConstructTriples = YYYYY ; if not set, use ResultSetMaxRows as fallback