Configuring the RAPCache to Use an In-Memory Database

If you can fit your entire database in memory, you may manually configure RAPCache to use an in-memory database (IMDB).

Switch from the relaxed durability disk-resident database (RDDB) to the IMDB:

  1. Use sp_cacheconfig to create a named cache of type inmemory_storage that is used to host data and log cache devices. A single cache must be shared for data and log devices.
  2. Use DISK INIT to create data and log cache devices on the named cache above.
  3. Use create database command with inmemory keyword and with DURABILITY = NO_RECOVERY to create the IMDB for RAPCache. By default, the IMDB is created based on the model database.
-- Create 4 GB cache for in-memory storage
sp_cacheconfig rapTAQcache, "4.5G", inmemory_storage
go

-- Create 4 GB cache device for rapTAQ data
DISK INIT name = "rapTAQdata",
          physname = "rapTAQcache",
          size = "4G",
          type = "inmemory"
go

-- Create 0.5 GB cache device for rapTAQ log
DISK INIT name = "rapTAQlog",
          physname = "rapTAQcache",
          size = "0.5G",
          type = "inmemory"
go

-- Create rapTAQIMDDB database using existing rapTAQ model database
create inmemory database rapTAQIMDB
    on rapTAQdata = ā€˜4g’
    log on rapTAQlog  = ā€˜0.5g’
with DURABILITY = NO_RECOVERY
go