Help Center> Distributed Cache Service> FAQs> Redis Usage> What Are the Constraints on Implementing Multi-DB on a Proxy Cluster Instance?
Updated on 2023-11-30 GMT+08:00

What Are the Constraints on Implementing Multi-DB on a Proxy Cluster Instance?

Note the following constraints when you consider implementing multi-DB:

  • Usage constraints:
    1. The SWAPDB command does not support multi-DB.
    2. The INFO KEYSPACE command does not return data of multi-DB.
    3. To query the total number of keys in each database, use the customized dbstats command. CPU usage will surge on the node executing this command.
    4. LUA scripts do not support multi-DB.
    5. The RANDOMKEY command does not support multi-DB.
    6. The SELECT command cannot be embedded in transactions.
    7. PUBLISH cannot be used in Lua scripts.
    8. The database number ranges from 0 to 255.
  • Performance constraints
    1. The FLUSHDB command deletes keys one by one, which takes a long time and is slower than the open-source native implementation. The execution speed of the FLUSHDB command is the same as that of the SCAN command (which should be tested by the customer).
    2. The DBSIZE command is time-consuming. Do not use it in the code.
    3. If multi-DB is used, the performance of the KEYS and SCAN commands deteriorates by up to 50%.
  • Other constraints:

    The backend storage rewrites keys based on certain rules. Keys in the exported RDB file are not the original keys. However, the access through the Redis protocol is not affected.

Procedure for Enabling or Disabling Multi-DB

By default, a Proxy Cluster instance is not enabled with multi-DB. Before enabling or disabling multi-DB for an instance, clear the instance data. Do as follows to enable multi-DB.

  1. Log in to the DCS console.
  2. Connect to the instance and run the FLUSHALL command to clear the instance data.
  3. On the Cache Manager page of the DCS console, click the desired DCS instance.
  4. Choose Instance Configuration > Parameters.
  5. To enable multi-DB, click Modify in the row that contains parameter multi-db, and change its value to yes.

    To disable multi-DB, change the value to no.

  6. Click Save and then confirm the modification. The instance does not need to be restarted.

Redis Usage FAQs

more