Performance
This guide will cover all sorts of topics related to Spree application performance
If you're using Spree Starter this gem is already pre-installed and pre-configured. If you're not using Spree Starter you can easily add it yourself - please see this git commit.
There are several configuration options you can put in
config/initializers/spree.rb
to adjust API caching configuration:Spree::Api::Config[:api_v2_cache_ttl] = 3600 # TTL for cached resources in seconds
This is the time when API objects will be available in cache storage. Objects such as Products also auto-expire when they are updated or one of their associated resources (eg. Variants) are updated also.
Sending emails, parsing big amounts of data - it's not recommended to do it in the web process.
We recommend setting up Sidekiq with ActiveJob, this required a Redis instance. Spree Starter users don't need to do anything as it's already pre-configured for them.
To enable caching in the development environment please type in your project directory:
bin/rails dev cache
or if you're using Spree Starter
docker-compose run web rails dev:cache
After that, you will need to restart your webserver / or stop/start docker-compose.
We strongly recommend using Memcached or Redis as cache storage.
Starter is pre-configured to work with Memcached. To enable caching please set the ENV variables:
MEMCACHEDCLOUD_SERVERS
- URL of the Memcached instanceMEMCACHEDCLOUD_USERNAME
/ MEMCACHEDCLOUD_PASSWORD
- username/password required to access instanceMEMCACHED_POOL_SIZE
- connection pool, defaults to 5
Last modified 2yr ago