Archives configuration
When the zip command-line tool is available, Swarm allows
users to download a ZIP archive of a file or folder. You configure the
archiving feature with the following configuration block in the
file:
SWARM_ROOT
/data/config.php
<?php
// this block should be a peer of 'p4'
'archives' => array(
'max_input_size' => 512 * 1024 * 1024, // 512M (in bytes)
'archive_timeout' => 1800, // 30 minutes
'compression_level' => 1, // 0-9
'cache_lifetime' => 60 * 60 * 24, // 1 day
),
The max_input_size
key specifies the maximum file/folder
content size that can be processed into a ZIP archive. The default value
permits up to 512 megabytes of content to be compressed. Smaller values
limit the amount of file/folder content but provide faster downloads; larger
values can allow increased scanning, syncing, compressing, and downloading
times.
The archive_timeout
key specifies the amount of time, in
seconds, to allow Swarm to prepare the ZIP archive for downloading. Shorter
times can limit the practical size of a ZIP archive, depending on the
performance of your network and the filesystem hosting Swarm; even with a
generous max_input_size
setting, if
archive_timeout
seconds have elapsed,
the archive operation is terminated.
The compression_level
key specifies the compression level
to use, and must be within the range 0
to
9
. 0
means no compression,
9
means maximum compression. As this value is increased,
smaller ZIP archives may result, but may require greater compression time.
Swarm uses the default of 1
, which provides a reasonable
tradeoff of fast compression times with light compression that can still
result in an archive notably smaller than the original file/folder content.
The cache_lifetime
key specifies the desired maximum age
of cached ZIP archives. Increasing the value increases the amount of time
that ZIP archives exist in the cache, which can improve the user experience
for frequently downloaded files. However, ZIP archives can be quite large
(depending on the size of your depot within the Helix Versioning Engine) and
can require significant disk storage. Decreasing the value can mitigate the
amount of disk space required for the cache; the tradeoff is that frequently
accessed ZIP archives may need to be generated more frequently, which can
have an impact on CPU and disk resources.