Skip to main content

Configure the cache services

Configure the cache services Snow Software MongoDB Service and Snow Software SLM Cache Server Service to change data storage path and change settings.

Note

To completely disable the cache report functionality, disable Snow Software MongoDB Service and Snow Software SLM Cache Server Service.

Task. Change data storage path

By default, MongoDB service will be installed in the default location of the installation of Snow License Manager and the cached data will be stored in the same location, for example, C:\Program Files\Snow Software\Snow License Manager\Services\MongoDB\.

For companies or organizations with large databases, the size of the cache data can grow to a point where the installation hard disk drive has not enough space. To change the data storage path, run a script that performs the following steps:

  1. Stops the service.

  2. Moves the current cache to the folder defined in the script.

  3. Configures MongoDB to run against the folder defined in the script.

  4. Starts the service.

To change data storage path:

  • Run the following script:

    # stop mongoDB service
    net stop SnowMongoDB 
    
    # the current path that mongoDB installed, VERIFY IT IS ALIGNED WITH YOUR INSTALLATION DIRECTORY
    $mongoDbFolderPath = "C:\Program Files\Snow Software\Snow License Manager\Services\MongoDB\"
    # new path to store data, ENTER YOUR DESIRED PATH
    $mongoDBStoragePath = "E:\Snow Software\MongoDBStorage\"
    
    # log path
    $logPath = $mongoDbFolderPath + "log\mongod.log"
    
    # data storage path 
    $dataFolderPath = $mongoDbFolderPath + "data"
    $newDataFolderPath = $mongoDBStoragePath + "data"
    
    # create target path if missing
    if (!(Test-Path -path $mongoDBStoragePath)) {
        New-Item -ItemType Directory -Force -Path $mongoDBStoragePath
    }
    
    # move folder to new locations
    if (Test-Path -path $dataFolderPath ) {
        $bin_path = $mongoDbFolderPath+ "bin"
        cd "$bin_path"
        .\mongod.exe --dbpath="' + $newDataFolderPath + '"
    
        # Saving permissions to data folder
        $acl = (Get-Item $dataFolderPath).GetAccessControl('Access')
        Move-Item -Path $dataFolderPath -Destination $newDataFolderPath -force
    
        # restoring permissions after data folder is moved
        $acl | Set-Acl $newDataFolderPath
        $lock = $newDataFolderPath + "\mongod.lock"
        Remove-Item $lock
    
        # run mongodb against new folders
        $exePath = $mongoDbFolderPath + 'bin\mongod.exe'
        $mongoPath= '"'+ $exePath + '" --auth --dbpath="' + $newDataFolderPath + '" --logpath="' + $logPath + '" --service'
        Set-Location HKLM:\SYSTEM\CurrentControlSet\Services\SnowMongoDB
        $mongoHKLMPath = Get-Location
        Set-ItemProperty -path $mongoHKLMPath -name ImagePath -Value $mongoPath
        Set-Location C:
        net start SnowMongoDB
    }
Task. Configure settings for the cache service

Configure the default settings for the cache service to, for example, configure when to run the cache service so that it is not run at the same time as for example the compliance service or the Data Update Job.

The caching service does not run at the same time as the Data Update Job and the Compliance service. If the Data Update Job or Compliance service starts during the caching run, caching will stop and continue the next day. Therefore, it is better to configure the caching to run so that it does not conflict with when Data Update Job and Compliance run. For more information, see the following example.

  • In the appsettings.json file, configure the settings according to the following table:

    Setting

    Description

    Value

    Logging level

    Configure to show basic or detailed information in the log file.

    If the logging level is set to "Default": "Information" the log file will show basic information.

    If the logging level is set to “Default“: “Debug” the log files will show very detailed information.

    "Serilog": {
    2    "MinimumLevel": {
    3      "Default": "Information",
    4      "Override": {
    5        "Microsoft": "Information",
    6        "System": "Warning"
    7      }
    8    }
    9  }

    Event viewer logs

    Check logs while solving issues.

    MongoDB url

    The connection string is encrypted in appsettings.json and should not be changed.

    "ConnectionStrings": {
    2    "MongoDBConnectionString": "mongodb://CacheServerAdmin:password@127.0.0.1:27017/cacheServer"
    3  }

    NATS url

    Should not be changed unless Snow License Manager application server has a different endpoint configuration for Snow Software Nats Service.

    "NatsEventBusServer": {
    2    "Name": "nats",
    3    "Address": "localhost",
    4    "Port": "4222",
    5    "EnableDataBroker": false
    6  }

    Table Report caching options

    Use the table to check or change which reports are enabled for caching for which users.

    Caching manual parallelization count

    Configure to limit or increase the number of parallel caching threads.

    Max parallelization during caching can by default use up to 50 % of CPU. However, if users need to use Snow License Manager during caching and if this is causing poor performance, then the maximum degree of parallelization can be set manually.

    The default value is "0". To limit the number of parallel caching threads, change the value to any positive integer.

    "CachingManualParallelizationCount" : 0

    Daily invalidation time

    Configure to set the time for removing previously cached reports.

    "DailyInvalidationTime": "18:00:00"

    Caching time window

    Caching start time

    Set to dedicate time in the system to only caching.

    These are important settings if the system resources are limited or if running multiple services at the same time can cause issues.

    Interval can be set to Daily, Weekly, Biweekly, or Monthly.

    "CachingTimeLimitHours": 6,
    2"CachingSchedule": {
    3    "Interval": "Daily",
    4    "StartDateTime": "2021-01-02T00:01:00"
    5}

    MongoDB data chunk size

    A property to configure the size of data to send to MongoDB each time. If memory consumption is a concern, reduce the value.

     "MongoDbDataChunkSize": 10000

    Compliance url

    Endpoints

    Should not be changed unless Snow License Manager application server has a different endpoint configuration for compliance service.

    "Compliance": {
    2    "BaseUrl": "http://localhost:8522",
    3    "StatusEndpoint": "licensing/{0}/status"
    4  }
Example 36.

In this example, a company has more than 500 000 devices and 100 Snow License Manager users. All reports for all users are cached. The caching of the reports will take more than 24 hours. The caching service is configured according to the following code:

"CachingTimeLimitHours": 6,
  "CachingSchedule": {
    "Interval": "Weekly",
    "StartDateTime": "2021-01-02T00:01:00"
  }

This means that, at the beginning of every week, the caching operation will run for 6 hours and then continue to run the next day. The caching will run for 6 hours every day until all reports are cached during a weekly run.

If a report takes more than six hours to be cached, increase CachingTimeLimitHours. If the whole caching is not completed for the given time, increase Interval. For example:

  • Increase CachingTimeLimitHours from 6 to 8 hours when the Applications per user and computer report take more than 6 hours to cache.

  • Increase Interval from Weekly to Biweekly or Monthly when the caching of all enabled reports is not completed in the given interval (Weekly in this example).

If the Interval is set to Weekly, the caching service will perform the following:

  1. Cache as many reports as possible during the time specified in CachingTimeLimitHours.

    In this example, the CachingTimeLimitHours is set to 6 hours.

  2. Continue the caching operation the next day for the reports that have not been cached during this week, starting with the oldest previously cached reports.

  3. When every report in the caching queue has been cached, there will be no more caching operation until the next scheduled caching interval.

    In this example, the Interval is set to Weekly.

  4. In the next scheduled caching interval, the caching service will cache the reports that have changed data since the last caching interval.