Managing Disk Space
Posit Connect can consume significant disk space as users deploy content over time. This page describes the main sources of disk usage and the configuration settings available to manage them.
Most disk usage accumulates in the Connect data directory (Server.DataDir, which defaults to /var/lib/rstudio-connect). You can check the current usage with:
Terminal
du -sh /var/lib/rstudio-connectBundle retention
Each deployment creates a new bundle on disk. By default, all previous bundles are retained indefinitely, which can consume significant space.
To limit the number of bundles retained per content item, set Applications.BundleRetentionLimit:
/etc/rstudio-connect/rstudio-connect.gcfg
[Applications]
BundleRetentionLimit = 3Older bundles are deleted periodically, which runs on the interval defined by Applications.BundleReapFrequency (default: 24h).
The limit counts only inactive bundles. The active bundle, and any bundle used by a report variant, are always retained in addition to the limit.
Publishers can also override this limit for an individual content item. This is useful if the content’s full history must be retained for business purposes, even when a server-wide limit is in effect, or conversely if some specific content bundles are known to be large and do not need to be retained.
Rendering output retention
Rendered content produces output each time it runs. Two settings control automatic cleanup of old renderings:
Applications.RenderingSweepLimit— Maximum renderings retained per content item. Default:30.Applications.RenderingSweepAge— Maximum age of a rendering. Default:30d.
The cleanup frequency is controlled by Applications.RenderingSweepFrequency (default: 1h).
Python environment cleanup
Python content uses virtual environments stored on disk. Connect removes unused environments automatically. For details on how environment caching works, see Environment caching.
The cleanup interval is controlled by Applications.PythonEnvironmentReapFrequency (default: 24h). To disable cleanup, set Applications.PythonEnvironmentReaping to false.
Job history cleanup
Connect stores metadata and output for completed jobs on disk. Two settings control automatic cleanup:
Jobs.MaxCompleted— Maximum completed jobs retained per content item. Default:1000.Jobs.OldestCompleted— Maximum age of a completed job. Default:30d.
A job is removed if either limit is exceeded.
Deleted content
When content is deleted, Connect normally moves its artifacts, including source bundle archives and directory trees, into {Server.DataDir}/trash and removes them in the background. If an artifact cannot be moved into trash, Connect removes it synchronously. The content is unavailable immediately, but its disk space might not be reclaimed until a later cleanup pass.
The cleanup interval is controlled by Applications.TrashReapFrequency (default: 5m). The optional Applications.TrashRetention setting controls how long retired artifacts remain on disk before cleanup (default: 0, which permits deletion on the next pass). Entries that cannot be removed remain in trash and are retried during later passes.
Runtime caches
Package caches are not automatically deleted when content is removed. When you delete a runtime cache, Connect moves it into {Server.DataDir}/trash and removes it in the background, the same as deleted content. The Applications.TrashReapFrequency and Applications.TrashRetention settings also apply to deleted runtime caches. See the Runtime Caches documentation for details on viewing and deleting these caches.
Applying changes
After updating the configuration file, restart Connect for the changes to take effect:
Terminal
sudo systemctl restart rstudio-connectSummary of space-saving settings
The following table summarizes all settings that help manage disk space:
| Setting | Default | Description |
|---|---|---|
Jobs.MaxCompleted |
1000 | Maximum completed jobs per application |
Jobs.OldestCompleted |
30d | Maximum age of completed jobs |
Applications.RenderingSweepLimit |
30 | Maximum renderings per application |
Applications.RenderingSweepAge |
30d | Maximum age of renderings |
Applications.RenderingSweepFrequency |
1h | Rendering cleanup frequency |
Applications.BundleRetentionLimit |
0 | Maximum bundles per application (0 = unlimited) |
Applications.BundleReapFrequency |
24h | Bundle cleanup frequency |
Applications.TrashReapFrequency |
5m | Retired artifact cleanup frequency |
Applications.TrashRetention |
0 | Minimum time retired artifacts remain on disk |
Applications.PythonEnvironmentReaping |
true | Enable Python environment cleanup |
Applications.PythonEnvironmentReapFrequency |
24h | Python environment cleanup frequency |
Recommended configuration for constrained environments
For environments with limited disk space, consider this configuration:
/etc/rstudio-connect/rstudio-connect.gcfg
[Jobs]
MaxCompleted = 100
OldestCompleted = 7d
[Applications]
RenderingSweepLimit = 10
RenderingSweepAge = 14d
RenderingSweepFrequency = 30m
BundleRetentionLimit = 3
BundleReapFrequency = 6h
PythonEnvironmentReaping = true
PythonEnvironmentReapFrequency = 6h