Hi,
When archiving and encrypting very large files with 7z it uses the majority of my CPU which is 16 threads. Is there a way to limit it to say 10 for example?
I have seen there is a switch named "-stm" but I'm not sure if that does it or what input it is looking for other than a hexadecimal value of some kind.
I don't want to change the "priority" of the process, I just want to limit the threads it is able to use. Similar to how make -j if possible.
[solved] Limit 7z CPU Usage
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
[solved] Limit 7z CPU Usage
Last edited by LockBot on Fri Feb 10, 2023 11:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Limit 7z CPU Usage
if you are using 7z provided by p7zip package, using
edit
as for
For 4x CPU -stmA switch is using 2 threads for sure. Important - it works only for
You need to install
-mmt1
approximately halves the CPU resource usage, -mmt2
will make it about 3/4 on 4x CPU.edit
as for
-stm
for half of the 16 threads try F0F0
or AAAA
, don't have such CPU to check it here.For 4x CPU -stmA switch is using 2 threads for sure. Important - it works only for
7zip
package, not p7zip-full.You need to install
7zip
separately and invoke it with 7zz
command.-=t42=-
Re: Limit 7z CPU Usage
-mmt works great. Exactly what I was looking for, thanks for the tip. I am using the p7zip package. I read the man pages for 7z and p7zip but neither of them mention anything other than -stm which is why I mentioned that, but -mmt works.
Thanks.
Re: [solved] Limit 7z CPU Usage
You're welcome. In case of compression of compressed files such as jpeg, mkv, flac, I prefer to use a low compression switch just to significantly reduce operation time. Here is a comparison for directory containing flac files. Note that no compression size for -mx=0 and -mx=1 is less -mx=3
7z a -r -t7z -m0=lzma2 -mx=0 ... 7z a -r -t7z -m0=lzma2 -mx=9
Code: Select all
Bites Switch Sec
220 948 859 orig.
220 491 866 -mx=0 07
220 508 908 -mx=1 09
220 529 718 -mx=3 14
214 545 781 -mx=5 15
205 809 680 -mx=7 62
205 809 680 -mx=9 102
-=t42=-
Re: [solved] Limit 7z CPU Usage
Ah, thanks. This is useful because I actually don't care so much about the compression, as where I'm putting this file only needs one copy of these, and it has plenty of space. And as your example results show, the file size difference at the end isn't really drastic enough to warrant the time spent.t42 wrote: ⤴Thu Aug 11, 2022 2:24 am You're welcome. In case of compression of compressed files such as jpeg, mkv, flac, I prefer to use a low compression switch just to significantly reduce operation time. Here is a comparison for directory containing flac files. Note that no compression size for -mx=0 and -mx=1 is less -mx=3
7z a -r -t7z -m0=lzma2 -mx=0 ... 7z a -r -t7z -m0=lzma2 -mx=9
Code: Select all
Bites Switch Sec 220 948 859 orig. 220 491 866 -mx=0 07 220 508 908 -mx=1 09 220 529 718 -mx=3 14 214 545 781 -mx=5 15 205 809 680 -mx=7 62 205 809 680 -mx=9 102
Cheers.