Skip to content

Manage Your Scratchpad

This page describes the resources, limits, restart behavior, and permissions that apply to the Scratchpad.

A scratchpad is a temporary q process that runs in a Rocky Linux container. Each user has their own scratchpad. While you can save the contents of the editor, any in-memory or on-disk state is only retained until the scratchpad session ends.

This page describes:

For logs and console messages, see Scratchpad logs. To cancel or reset a query, or to set timeouts, see Cancel, reset, and timeouts.

Scratchpad resources

The CPU and memory resources for the Scratchpad can be configured in your values.yaml. See Scratchpad resources for details. Any changes made to these resources apply to all users.

A Scratchpad is limited (by default) to 500 MiB of RAM and 250 MiB of disk. When a Scratchpad exceeds either limit, its process shuts down and restarts. To optimize performance, limit the amount of data returned in your query; for example: select[10000] from myTable to return 10,000 rows of data.

Preprovisioning

By default, kdb Insights Enterprise keeps one scratchpad preprovisioned so it can be immediately assigned to the next user who logs in. To save resources when scratchpads are infrequently used, you can disable this feature using the quickStartup property in the values.yaml:

kxi-scratchpad-manager:
  kxi-scratchpad:
    quickStartup:
      enabled: false

If there is often a delay in scratchpad responsiveness when logging in, due to multiple users logging in simultaneously, you can adjust the number of preprovisioned scratchpads using the provisionPool property as shown below. Note that setting this to 0 is not supported, and the feature can only be disabled by setting enabled to false as shown above.

kxi-scratchpad-manager:
  kxi-scratchpad:
    quickStartup:
      provisionPool: 2

Disk operations

The scratchpad environment includes a 250 MiB disk mounted to /tmp that can be used for temporary file storage. This folder is ephemeral, and is cleared when the Scratchpad process terminates due to logout, reset or crash. The rest of the file system is read-only.

For example, if you install Python packages in the Scratchpad, they must go to a writable location. Packages installed with .kxi.install are placed in the directory set by KX_PACKAGE_PATH, so you don't need to choose a location. If you install packages by other means, use /tmp, which is the only writable location. Monitor the disk space limit, as installing packages or writing too much data may exhaust the available space. Refer to Install libraries and modules for details.

Pipelines also use on-disk storage. This means both pipeline tests and pipelines written in q or Python can write to /tmp, and exceeding available disk space can trigger a Scratchpad restart.

Scratchpad restart

Scratchpads terminate after one hour of inactivity, or if a resource limit is exceeded. After a Scratchpad restart, any in-memory or on-disk state is lost.

You can also restart your own Scratchpad with Reset. Refer to Cancel, reset, and timeouts.

Keycloak permissions

The following Scratchpad roles are available for fine-grained permissions.

Role Description
insights.scratch.display Evaluating q and Python expressions, and displaying or visualizing the results
insights.scratch.data Querying a database using the query builder.
insights.scratch.sql Querying a database using SQL.
insights.scratch.qsql Querying a database using the qsql.
insights.scratch.pipeline.test Running pipeline tests in the Scratchpad

See Keycloak permissions for further details on roles.

Further reading

Back to top