Comments
Patch
@@ -1682,6 +1682,22 @@ Controls generic server settings.
See also ``server.zliblevel``.
+``zstdthreads``
+ Integer number of threads to use for compressing data. The default value
+ (``0``) uses a single thread. Negative values attempt to detect the number
+ of available CPU cores and use that many threads.
+
+ For low compression levels, zstandard will be able to compress data faster
+ than either Mercurial can send it or the client can consume it, thus
+ undermining the benefits of multi-threaded compression. Therefore,
+ multi-threaded compression is most useful when combined with ``zstdlevel``
+ to increase the compression level while preserving reasonable throughput.
+
+ Each compression operation will use this many threads. So if the value is
+ ``4`` and there are ``3`` requests being served concurrently, ``12``
+ threads will perform compression. It is important to consider the effects
+ on server scaling and performance before setting this option.
+
``smtp``
--------
@@ -127,6 +127,11 @@ class webproto(wireproto.abstractserverp
if level is not None:
opts['level'] = level
+ if engine.name() == 'zstd':
+ threads = self.ui.configint('server', 'zstdthreads')
+ if threads:
+ opts['threads'] = threads
+
return HGTYPE2, engine, opts
# No mutually supported compression format. Fall back to the