Butler CW 4.2 released

Butler CW preloads apps into client-managed Qlik Sense servers, making the apps more responsive when users then access them. Latest version adds several security enhancements and the ability to run Butler CW as a Windows service.

Butler CW 4.2 released

This is one of the older members in the Butler family, going back to 2017.

Butler CW does one thing only: Loads Sense apps into the (client-managed) Qlik Sense associative engine cache.

Windows, Linux and macOS binaries are available from the releases page.
A Docker image is available on Docker Hub.

Also known as cache warming or pre-caching, the idea is to make sure Qlik Sense apps will already be in memory on the Sense server once users try to access the app. Response time will be faster with a better user experience as a result.

A unique caching schedule can be defined for each app. It's also possible to define which of several Sense servers an app should be pre-cached on.

It might be tempting to pre-cache lots of apps but the effect may then become the opposite - some apps will be ejected from the cache when the Qlik Sense engine runs out of RAM.

What's new

The tool hasn't seen much change over the past couple of years but with version 4.2.0 some interesting features are added:

  • Add command line options for specifying which config files to use. This makes it much easier to run Butler CW as a Windows service.
  • Add virus/malware scanning as part of the build process.
  • Windows binaries are now signed with a commercial app signing certificate. macOS binaries are notarized using Apple's standard signing process.
  • All dependencies updated to latest versions. Patched and ready to go!

Running as a Windows service

Most Butler tools are now available as standalone binaries, meaning that they can reasonably easily be made to run as Windows services.

Running as a service is a significant advantage when it comes to tools that are supposed to support production Qlik Sense environments.

When running as a service Butler CW (and other Butler tools) get automatic restarts when a Windows server boots, restarts if something goes wrong, possible to monitor and control the service remotely etc.

NSSM - the Non-Sucking Service Manager

nssm is a free tool that installs almost any Windows application as a service. There's no installer, just download the nssm ZIP, unblock it and extract to some good location such as d:\tools\nssm.

Setting the scene

The work below is done in PowerShell on a Windows 10 computer. Works the same on Windows server. Remember to run nssm in an admin PowerShell window - things will fail otherwise.

These are the files we will be using.

PS C:\code\butler-cw> dir

    Directory: C:\code\butler-cw

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        12/04/2023     16:33           1634 butler-cw-app-config.yaml
-a----        12/04/2023     16:38           4258 butler-cw-config.yaml
-a----        13/04/2023     15:05       60683272 butler-cw.exe

PS C:\code\butler-cw> dir ..\nssm\

    Directory: C:\code\nssm

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        31/08/2014     16:34         331264 nssm.exe

PS C:\code\butler-cw>

Let's take a look at the apps definition file too (butler-cw-app-config.yaml):

# Rename this file to apps.yaml, then edit it as needed.

# This file is used to specifiy what Qlik Sense apps should be loaded by the cache warmer, when/how often they should be loaded, 
# what filters should be applied when apps are opened etc 
# Frequency attribute must follow rules described here: https://breejs.github.io/later/parsers.html#text
# 1. Second level scheduling does not work as expected. 
#    For example, 'every 55 seconds' will trigger on each whole minute, plus 5 seconds before each whole minute.
#    Use minutes as most detailed level of scheduling. 
#    More info at https://github.com/ptarmiganlabs/butler-cw/issues/116
# Fields for each app:
# server: IP or FQDN of the Sense server where the app should be loaded
# appId: Id of app to load
# appDescription: Free text description of the app. Can be anything - no check is done Sense APIs using this text
# appStepThroughSheets: Set to true to have Butler CW step through all sheets of the app, triggering all charts etc to calculate in all sheets
# doInitialLoad: Set to true to do an initial load of this app when Butler CW is started.
# freq: Text value representation of how often the app should be loaded

  - server:
    appId: e28f9c40-6138-42f4-81c3-1d61860baa27
    appDescription: Parking tickets by city
    appStepThroughSheets: true
    doInitialLoad: true
    freq: at 5:00 pm
  - server:
    appId: c840670c-7178-4a5e-8409-ba2da69127e2
    appDescription: Meetup.com
    appStepThroughSheets: true
    doInitialLoad: true
    freq: every 20 minutes

Installing the service

Installing Butler CW as a service is easy and can be done entirely from the command line:

PS C:\code\butler-cw> ..\nssm\nssm.exe install "Butler CW" C:\code\butler-cw\butler-cw.exe
Service "Butler CW" installed successfully!
PS C:\code\butler-cw> ..\nssm\nssm.exe set "Butler CW" Description "Butler CW is a cache warmer for Qlik Sense."
Set parameter "Description" for service "Butler CW".
PS C:\code\butler-cw> ..\nssm\nssm.exe set "Butler CW" DisplayName "Butler CW"
Reset parameter "DisplayName" for service "Butler CW" to its default.
PS C:\code\butler-cw> ..\nssm\nssm.exe set "Butler CW" Start SERVICE_AUTO_START
Set parameter "Start" for service "Butler CW".
PS C:\code\butler-cw> ..\nssm\nssm.exe set "Butler CW" AppParameters "--config-file .\butler-cw-config.yaml --app-config-file .\butler-cw-app-config.yaml --log-level info"
Set parameter "AppParameters" for service "Butler CW".
PS C:\code\butler-cw>

The service has been created but is still stopped:

A Windows service for Butler CW has been created, but is still stopped.

Click the Start button and the service starts.

Checking the log folder there is a new log file there. Success!

Log from Butler CW starting up