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

Test images with different utilization #33

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

nirs
Copy link
Member

@nirs nirs commented Oct 17, 2024

Enhance createTestImage to create image with configurable utilization and add 2 additional test:

  • 0% utilization - this the best case when all work can be eliminated without reading any cluster from storage.

  • 100% utilization - this is the worst case for both compressed and uncompressed images, when we have to read and decompress all clusters.

The test reveals that we have 2 issues:

  • Reading empty uncompressed image is almost 3 times slower compare to reading fully allocated image (3430 MB/s vs 8783 MB/s). Even with the inefficient io.Reader interface, we except to perform zero read many times faster compared with reading actual cluster from storage.

  • Decompression is extremely slow (39.28 MB/s for fully allocated image).

Example run:

% go test -bench Read -count=1
BenchmarkRead0p/qcow2-12         	      14	  78238414 ns/op	3430.99 MB/s	 1051160 B/op	      39 allocs/op
BenchmarkRead0p/qcow2_zlib-12    	      14	  78577923 ns/op	3416.17 MB/s	 1051733 B/op	      39 allocs/op
BenchmarkRead50p/qcow2-12        	      21	  54889353 ns/op	4890.48 MB/s	 1183231 B/op	      45 allocs/op
BenchmarkRead50p/qcow2_zlib-12   	       1	3466799292 ns/op	  77.43 MB/s	736076536 B/op	  178764 allocs/op
BenchmarkRead100p/qcow2-12       	      38	  30562127 ns/op	8783.27 MB/s	 1182901 B/op	      45 allocs/op
BenchmarkRead100p/qcow2_zlib-12  	       1	6834526167 ns/op	  39.28 MB/s	1471530256 B/op	  357570 allocs/op

Enhance createTestImage to create image with configurable utilization
and add 2 additional test:

- 0% utilization - this the best case when all work can be eliminated
  without reading any cluster from storage.

- 100% utilization - this is the worst case for both compressed and
  uncompressed images, when we have to read and decompress all clusters.

The test reveals that we have 2 issues:

- Reading empty uncompressed image is almost 3 times slower compare to
  reading fully allocated image (3430 MB/s vs 8783 MB/s). Even with the
  inefficient io.Reader interface, we except to perform zero read many
  times faster compared with reading actual cluster from storage.

- Decompression is extremely slow (39.28 MB/s for fully allocated
  image).

Example run:

    % go test -bench Read -count=1
    BenchmarkRead0p/qcow2-12         	      14	  78238414 ns/op	3430.99 MB/s	 1051160 B/op	      39 allocs/op
    BenchmarkRead0p/qcow2_zlib-12    	      14	  78577923 ns/op	3416.17 MB/s	 1051733 B/op	      39 allocs/op
    BenchmarkRead50p/qcow2-12        	      21	  54889353 ns/op	4890.48 MB/s	 1183231 B/op	      45 allocs/op
    BenchmarkRead50p/qcow2_zlib-12   	       1	3466799292 ns/op	  77.43 MB/s	736076536 B/op	  178764 allocs/op
    BenchmarkRead100p/qcow2-12       	      38	  30562127 ns/op	8783.27 MB/s	 1182901 B/op	      45 allocs/op
    BenchmarkRead100p/qcow2_zlib-12  	       1	6834526167 ns/op	  39.28 MB/s	1471530256 B/op	  357570 allocs/op

Signed-off-by: Nir Soffer <nirsof@gmail.com>
@nirs nirs force-pushed the test-utilization branch from bbd632d to 1ed4fb7 Compare October 17, 2024 18:02
@nirs nirs requested a review from AkihiroSuda October 17, 2024 19:16
@nirs nirs mentioned this pull request Oct 17, 2024
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 5641962 into lima-vm:master Oct 18, 2024
2 checks passed
@nirs nirs deleted the test-utilization branch October 18, 2024 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants