Command Cache

Starting from release 2.2, OrientDB supports caching of commands results. Caching command results has been used by other DBMSs and proven to dramatically improve the following use cases:

  • database is mostly read than write
  • there are a few heavy queries that result a small result set
  • you have available RAM to use or caching results

By default, the command cache is disabled. To enable it, set command.cache.enabled=true. Look at the Studio page about Command Cache.

Settings

There are some settings to tune the command cache. Below find the table containing all the available settings.

ParameterDescriptionTypeDefault value
command.cache.enabledEnable command cacheBooleanfalse
command.cache.evictStrategyCommand cache strategy between: [INVALIDATE_ALL,PER_CLUSTER]String.classPER_CLUSTER
command.cache.minExecutionTimeMinimum execution time to consider caching result setInteger.class10
command.cache.maxResultsetSizeMaximum resultset time to consider caching result setInteger500

Eviction strategies

Using a cache that holds old data could be meaningless, unless you could accept eventual consistency. For this reason, the command cache supports 2 eviction strategies to keep the cache consistent:

  • INVALIDATE_ALL to remove all the query results at every Create, Update and Delete operation. This is faster than PER_CLUSTER if many writes occur.
  • PER_CLUSTER to remove all the query results only related to the modified cluster. This operation is more expensive then INVALIDATE_ALL