[MXS-1475] Create on-demand caching that can easily be enabled Created: 2017-10-16  Updated: 2018-03-21  Resolved: 2018-03-16

Status: Closed
Project: MariaDB MaxScale
Component/s: cache
Affects Version/s: None
Fix Version/s: 2.3.0

Type: New Feature Priority: Major
Reporter: Michaël de groot Assignee: Johan Wikman
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-14074 Please implement ignorable SET PROXY ... Closed
Sprint: 2017-46, MXS-SPRINT-50, MXS-SPRINT-51, MXS-SPRINT-52, MXS-SPRINT-53

 Description   

Hi,

Please create on-demand caching (versus caching everything). In most ORM's it is quite difficult to add a comment in the query, so I would prefer to use proxy-session variables:

SET PROXY cache_enabled=1;
SET PROXY cache_soft_ttl=3600;
SET PROXY cache_hard_ttl=3630;

This provides functionality for a couple of use cases:

  • 90% of the queries are not cacheable and in any case cheap to execute
  • Some queries are safe to cache for a minute, other queries are safe to cache for a day or a month

Please make this work out of the box by just adding 'filter=ondemandcache' (or however you want to call it) to router config, optionally setting default ttl's but with a sane default built in as well (5 minutes / 5 minuets + 30 seconds?). Please also add filter=ondemandcache in the example config as (I suppose?) the extra expense for checking a 'SET PROXY' command is very small. If you start to use SET PROXY for other settings it would need to be checked anyways.

Thank you,
Michaël



 Comments   
Comment by Johan Wikman [ 2018-03-16 ]

With the following user variables

  • @maxscale.cache.populate
  • @maxscale.cache.use
  • @maxscale.cache.soft_ttl
  • @maxscale.cache.hard_ttl
    it is now possible for the client to control the caching behaviour.

For instance:

SET @maxscale.cache.soft_ttl=600;
SELECT a, b FROM unimportant;
SET @maxscale.cache.soft_tll=60;
SELECT c, d FROM critical;

Generated at Thu Feb 08 04:07:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.