简体   繁体   中英

How to enable caching in ArangoDB via Docker or arangojs?

I would like to enable caching in ArangoDB, automatically when my app start.

I'm using docker-compose to start the whole thing but apparently there's no simple parameter to enable caching in ArangoDB official image.

According to the doc , all the files in /docker-entrypoint-initdb.d/ are executed at container start. So I added a js file with that code:

require('@arangodb/aql/cache').properties({mode: 'on'});

It is indeed executed but caching doesn't seem to be enabled (from what I see with arangosh within the container).

My app is a JS app using arangojs , so if I can do it this way, I'd be happy too.

Thanks!

According to the performance and server config docs, you can enable caching in several ways.

Your method of adding require("@arangodb/aql/cache").properties({ mode: "on" });to a .js file in the /docker-entrypoint-initdb.d/ directory should work, but keep an eye on the logs. You may need to redirect log output with a different driver (journals, syslog, etc.) to see what's going on. Make sure to run the command via arangosh to see if it works.

If that's a bust, you might want to see if there is a way to pass parameters at runtime (such as --query.cache-mode on ). Unfortunately, I don't use Docker Compose, so I can't give you direct advice here, but try something like -e QUERY.CACHE-MODE=ON

If there isn't a way to pass params, then you could modify the config file: /etc/arangodb3/arangod.conf .

And don't forget about the REST API methods for system management. You can access AQL configuration (view and alter) in the Web UI by clicking on the Support -> Rest API -> AQL .

One thing to keep in mind - I'm not sure if the caching settings are global or tied to a specific database. View the configuration on multiple databases (including _system ) to test the settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM