Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mksquashfs speed drop when using lz4 high compression #215

Open
fmartinsons opened this issue Jan 12, 2023 · 0 comments
Open

mksquashfs speed drop when using lz4 high compression #215

fmartinsons opened this issue Jan 12, 2023 · 0 comments
Assignees
Labels
Milestone

Comments

@fmartinsons
Copy link

fmartinsons commented Jan 12, 2023

Hello, I was using mksquashfs 4.3 in an embedded environment (distro built using yocto) for a long time and I recently update to 4.4 (lz4 version 1.9.2)

I noticed a strong loss of speed when creating the squashfs, below is a reproduction using /usr as a source directory (I always used the proc and mem restrictions because my target have some sensible processus that don't like being too spoiled from resources)

4.3:

root@tap-0000C99F:~# mksquashfs -version
mksquashfs version 4.3-git (2014/09/12)
copyright (C) 2014 Phillip Lougher <phillip@squashfs.org.uk>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2,
or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
root@tap-0000C99F:~#
root@tap-0000C99F:~# du -sh /usr/
214.2M	/usr/
root@tap-0000C99F:~#
root@tap-0000C99F:~# time mksquashfs /usr/  test.squashfs -processors 1 -mem 16M -noappend -comp lz4 -Xhc
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on test.squashfs, block size 131072.
[========================================================================================================================================================================|] 7525/7525 100%

Exportable Squashfs 4.0 filesystem, lz4 compressed, data block size 131072
	compressed data, compressed metadata, compressed fragments, compressed xattrs
	duplicates are removed
Filesystem size 85656.21 Kbytes (83.65 Mbytes)
	36.28% of uncompressed filesystem size (236074.62 Kbytes)
Inode table size 92815 bytes (90.64 Kbytes)
	38.23% of uncompressed inode table size (242795 bytes)
Directory table size 93154 bytes (90.97 Kbytes)
	48.76% of uncompressed directory table size (191057 bytes)
Number of duplicate files found 412
Number of inodes 7282
Number of files 6273
Number of fragments 520
Number of symbolic links  292
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 717
Number of ids (unique uids + gids) 3
Number of uids 2
	<edited>
Number of gids 3
	<edited>

real	0m30.071s
user	0m11.044s
sys	0m0.962s

4.4:

root@tap-0000C99F:~# mksquashfs -version
mksquashfs version 4.4 (2019/08/29)
copyright (C) 2019 Phillip Lougher <phillip@squashfs.org.uk>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2,
or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
root@tap-0000C99F:~#
root@tap-0000C99F:~# du -sh /usr/
214.2M	/usr/
root@tap-0000C99F:~#
root@tap-0000C99F:~# time mksquashfs /usr/  test.squashfs -processors 1 -mem 16M -noappend -comp lz4 -Xhc
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on test.squashfs, block size 131072.
[================================================================================================================================================================================|] 7525/7525 100%

Exportable Squashfs 4.0 filesystem, lz4 compressed, data block size 131072
	compressed data, compressed metadata, compressed fragments,
	compressed xattrs, compressed ids
	duplicates are removed
Filesystem size 85355.88 Kbytes (83.36 Mbytes)
	36.15% of uncompressed filesystem size (236094.99 Kbytes)
Inode table size 92793 bytes (90.62 Kbytes)
	38.22% of uncompressed inode table size (242795 bytes)
Directory table size 92924 bytes (90.75 Kbytes)
	48.64% of uncompressed directory table size (191057 bytes)
Number of duplicate files found 412
Number of inodes 7282
Number of files 6273
Number of fragments 520
Number of symbolic links  292
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 717
Number of ids (unique uids + gids) 3
Number of uids 2
	<edited>
Number of gids 3
	<edited>

real	1m48.139s
user	0m42.668s
sys	0m0.523s

So 4 times factor !!

I dig a little and found lz4/lz4#845 , so I decided to upgrade lz4 to 1.9.4, I had still the same speed loss. Then, I updated mksquashfs to 4.5.1 and again , the speed remained the same.

I continued my search and found that the culprit was this commit, after reverting it , I get back to the original speed I had with mksquashfs 4.3.

To better cornered the issue I also did the following:

  • mksquashfs 4.3 with lz4 1.9.2: no speed loss
  • mksquashfs 4.4 without c4f943a and lz4 1.9.2: no speed loss
  • mksquashfs 4.5.1 without c4f943a and lz4 1.9.4: no speed loss

Any chance that you can find what is the problem here ?
If you find that lz4 is finally the culprit, I'm ready to fill a bug in their repo too.
Moreover, I'm available to make more tests on my setup if you want.

Thank you

@plougher plougher self-assigned this Jan 29, 2023
@plougher plougher added the bug label Jan 29, 2023
@plougher plougher added this to the Undecided milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants