[SRU] Image fetch speed from Glance to Cinder volume service can be slow and capped by client CPU

Bug #2020139 reported by Nobuto Murata
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance Client
Fix Committed
Undecided
Unassigned
Ubuntu Cloud Archive
Fix Released
Undecided
Unassigned
Bobcat
Fix Released
Undecided
Unassigned
Caracal
Fix Released
Undecided
Unassigned
Yoga
Fix Released
Undecided
Rodrigo Barbieri
python-glanceclient (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Rodrigo Barbieri
Noble
Fix Released
Undecided
Unassigned
python-openstacksdk (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Rodrigo Barbieri
Noble
Fix Released
Undecided
Unassigned

Bug Description

*********** SRU TEMPLATE AT THE BOTTOM **************

When Cinder volume service creates a volume from an image, it will download an image from Glance to a cinder-volume unit (to be precise, when CoW is not available by the backend between Glance and Cinder).

The image fetch speed is not super fast as of today:

2023-05-17 02:52:28.275 158391 DEBUG cinder.image.image_utils [req-e4234307-ae7c-4220-a10a-15760679ac01 a32b8e6ed20f484eba8ddae8f7b6eb1e 08dd29cd8676470c8e0b73d2667f8cf0 - - -] Image fetch details: dest /var/lib/cinder/conversion/image_fetch_741953c3-08f7-43b6-b423-2be938ac8d02_bc1hvgd7cinder@cinder-ceph, size 1907.35 MB, duration 27.80 sec fetch /usr/lib/python3/dist-packages/cinder/image/image_utils.py:637
2023-05-17 02:52:28.275 158391 INFO cinder.image.image_utils [req-e4234307-ae7c-4220-a10a-15760679ac01 a32b8e6ed20f484eba8ddae8f7b6eb1e 08dd29cd8676470c8e0b73d2667f8cf0 - - -] Image download 1907.35 MB at 68.61 MB/s

-> ~ 549 Mbps

By running a profiler, it looks like serious_integrity_iter (glanceclient/common/utils.py) is consuming a lot of CPU cycles on the client side (in this case the cinder-volume unit).

Image caching can overcome this kind of challenges but this report is for when we need to download images (new images, updated images, etc.).
https://docs.openstack.org/cinder/latest/admin/image-volume-cache.html

===============
SRU DESCRIPTION
===============

[Impact]

This issue causes images to be download much slower than they should, causing VM creation to potentially time out if the image is too big and takes too long. The fix proposed greatly improves performance and prevents timeouts in most cases where it would timeout without the fix.

[Test case]

Steps for python-glanceclient:
------------------------------

1. Deploy OpenStack with Cinder and Glance

2. Upload a resonable large image, like jammy ~650mb is enough.

3. Create a volume from the image

openstack volume create --size 3 --image jammy v1

4. Check the logs for messages of time to fetch/download the image:

... cinder.image.image_utils ... Image fetch details: dest /var/lib/cinder/conversion/image_fetch_ed429779-0d11-45cb-8ee5-fee7c2003d86_rubea933juju-056b6e-jy3-0@LVM-default, size 645.16 MB, duration 3.59 sec fetch ...

... cinder.image.image_utils ... Image download 645.16 MB at 179.58 MB/s

5. Repeat steps (3) and (4) 3 times just to make sure it is consistent and to have an average (avoid underlying infra fluctuations)

6. Install fix and restart all cinder services (such as apache2, cinder-scheduler and cinder-volume)

7. Repeat steps (3), (4) and (5), and make sure the new duration and download rate is at least about 50% faster.

Steps for python-openstacksdk:
------------------------------

1. Deploy OpenStack with Glance

2. Upload a resonable large image, like jammy ~650mb is enough.

3. Install python3-openstackclient in your client machine

sudo apt install python3-openstackclient

4. Download the image (repeat about 5 times to have an average)

time openstack image save jammy --file /dev/null

5. Install fixed package (python3-openstacksdk)

6. Download the image again (repeat about 5 times to have an average). This time there should be a significant decrease in time

[Where problems could occur]

If there are issues with the fix, it could impact the ability to download images at all, therefore impacting the ability to create volumes from images, and create VMs. Reverting the package is enough to undo the changes and restore previous functionality.

[Other Info]

Both python-glanceclient and openstacksdk fixes listed below are necessary.

https://review.opendev.org/c/openstack/openstacksdk/+/883461

https://review.opendev.org/c/openstack/python-glanceclient/+/924060

Revision history for this message
Nobuto Murata (nobuto) wrote :

By changing the CHUNKSIZE from 64 KiB to 1 MiB, it looks like the CPU was used more efficiently and it does the trick.

2023-05-17 11:54:23.080 376143 DEBUG cinder.image.image_utils [req-8228848b-f037-4a6a-802e-de7ffe62bae6 a32b8e6ed20f484eba8ddae8f7b6eb1e 08dd29cd8676470c8e0b73d2667f8cf0 - - -] Image fetch details:
 dest /var/lib/cinder/conversion/image_fetch_741953c3-08f7-43b6-b423-2be938ac8d02_gnmu2b9ycinder@cinder-ceph, size 1907.35 MB, duration 14.44 sec fetch /usr/lib/python3/dist-packages/cinder/image/i
mage_utils.py:639
2023-05-17 11:54:23.080 376143 INFO cinder.image.image_utils [req-8228848b-f037-4a6a-802e-de7ffe62bae6 a32b8e6ed20f484eba8ddae8f7b6eb1e 08dd29cd8676470c8e0b73d2667f8cf0 - - -] Image download 1907.3
5 MB at 132.10 MB/s

-> 1,057 Mbps

`openstack image save` with openstacksdk has a similar issue so I reported it separately as:
https://storyboard.openstack.org/#!/story/2010759

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)
Changed in python-glanceclient:
status: New → In Progress
Nobuto Murata (nobuto)
description: updated
Revision history for this message
Nobuto Murata (nobuto) wrote : Re: Image fetch speed from Glance to Cinder volume service can be slow and capped by client CPU
Changed in python-glanceclient:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-glanceclient 4.4.0

This issue was fixed in the openstack/python-glanceclient 4.4.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/python-glanceclient/+/924060

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-glanceclient (stable/2023.1)

Reviewed: https://review.opendev.org/c/openstack/python-glanceclient/+/924060
Committed: https://opendev.org/openstack/python-glanceclient/commit/3a2ef8b105ef46cc46df90d5b6cee71b909855f1
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit 3a2ef8b105ef46cc46df90d5b6cee71b909855f1
Author: Nobuto Murata <email address hidden>
Date: Fri May 19 09:36:49 2023 +0900

    Bump the CHUNKSIZE to use CPU more efficiently

    The chunk size used for downloading images was 64KiB for some time. That
    is okay for relatively small images but the client side of CPU can be a
    bottleneck especially for large images. Bump the default chunk size from
    64KiB to 1MiB so we can use the client side CPU more efficiently.

    [64KiB chunk size - current]
    INFO cinder.image.image_utils Image download 1907.35 MB at 68.61 MB/s
    -> ~ 549 Mbps

    [1MiB chunk size - patched]
    INFO cinder.image.image_utils Image download 1907.35 MB at 132.10 MB/s
    -> 1,057 Mbps

    Closes-Bug: #2020139
    Change-Id: I8b6e19621fc989526b02319d88fcfde88a17eee0
    (cherry picked from commit 7d78cc4b9d43f5abdf8c7fa05e37ab8c8122c325)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-glanceclient 4.3.2

This issue was fixed in the openstack/python-glanceclient 4.3.2 release.

summary: - Image fetch speed from Glance to Cinder volume service can be slow and
- capped by client CPU
+ [SRU] Image fetch speed from Glance to Cinder volume service can be slow
+ and capped by client CPU
Changed in cloud-archive:
status: New → Fix Released
Changed in python-glanceclient (Ubuntu):
status: New → Fix Released
Changed in python-openstacksdk (Ubuntu):
status: New → Fix Released
Changed in python-glanceclient (Ubuntu Jammy):
assignee: nobody → Rodrigo Barbieri (rodrigo-barbieri2010)
status: New → In Progress
Changed in python-glanceclient (Ubuntu Noble):
status: New → Fix Released
Changed in python-openstacksdk (Ubuntu Noble):
status: New → Fix Released
Changed in python-openstacksdk (Ubuntu Jammy):
assignee: nobody → Rodrigo Barbieri (rodrigo-barbieri2010)
status: New → In Progress
description: updated
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :
description: updated
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :
description: updated
Revision history for this message
Heitor Alves de Siqueira (halves) wrote :

Thanks for the patches, Rodrigo!

We've had a quick OOB discussion about the patch context, and the debdiffs will be slightly adjusted to remove some upstream changes that are not required for the Ubuntu packages. Once those are addressed, feel free to let a sponsor know!

Changed in python-openstacksdk (Ubuntu Jammy):
status: In Progress → Incomplete
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :
Changed in python-openstacksdk (Ubuntu Jammy):
status: Incomplete → In Progress
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :

Hi Heitor. Thanks for the feedback. I uploaded the updated debdiff labelled as v2 above. Please check whether that one is good when you have a chance.

Revision history for this message
Heitor Alves de Siqueira (halves) wrote :

Thanks for the changes, Rodrigo! The v2 does align better with the "minimum required changes" policy, and the rest of the debdiff looks good as well.

Sponsored for Jammy.

Revision history for this message
Nick Rosbrook (enr0n) wrote : Please test proposed package

Hello Nobuto, or anyone else affected,

Accepted python-openstacksdk into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/python-openstacksdk/0.61.0-0ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in python-openstacksdk (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Changed in python-glanceclient (Ubuntu Jammy):
status: In Progress → Fix Committed
Revision history for this message
Nick Rosbrook (enr0n) wrote :

Hello Nobuto, or anyone else affected,

Accepted python-glanceclient into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/python-glanceclient/1:3.6.0-0ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (python-openstacksdk/0.61.0-0ubuntu2)

All autopkgtests for the newly accepted python-openstacksdk (0.61.0-0ubuntu2) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

heat/1:18.0.1-0ubuntu1.2 (amd64)
heat/unknown (s390x)
neutron/unknown (amd64)
python-os-client-config/unknown (s390x)
python-osc-lib/unknown (s390x)
python-oslo.limit/unknown (s390x)
python-senlinclient/unknown (s390x)
senlin/1:13.0.0-0ubuntu1 (ppc64el)
senlin/unknown (s390x)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#python-openstacksdk

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Guillaume Boutry (gboutry) wrote : Please test proposed package

Hello Nobuto, or anyone else affected,

Accepted python-glanceclient into yoga-proposed. The package will build now and be available in the Ubuntu Cloud Archive in a few hours, and then in the -proposed repository.

Please help us by testing this new package. To enable the -proposed repository:

  sudo add-apt-repository cloud-archive:yoga-proposed
  sudo apt-get update

Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-yoga-needed to verification-yoga-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-yoga-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-yoga-needed
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :
tags: added: verification-done-jammy
removed: verification-needed-jammy
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :
description: updated
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-glanceclient - 1:3.6.0-0ubuntu2

---------------
python-glanceclient (1:3.6.0-0ubuntu2) jammy; urgency=medium

  * d/p/lp2020139.patch: Bump the CHUNKSIZE to
    use CPU more efficiently (LP: #2020139).

 -- Rodrigo Barbieri <email address hidden> Mon, 19 May 2025 14:04:07 +0000

Changed in python-glanceclient (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-openstacksdk - 0.61.0-0ubuntu2

---------------
python-openstacksdk (0.61.0-0ubuntu2) jammy; urgency=medium

  * d/p/lp2020139.patch: Bump the chunk_size to
    use CPU more efficiently (LP: #2020139).

 -- Rodrigo Barbieri <email address hidden> Thu, 22 May 2025 13:25:18 +0000

Changed in python-openstacksdk (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Chris Halse Rogers (raof) wrote : Update Released

The verification of the Stable Release Update for python-glanceclient has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Edward Hope-Morley (hopem) wrote :

the focal-yoga verification was provided in comment #19 but tags not updated so getting that done.

tags: added: verification-yoga-done
removed: verification-yoga-needed
Revision history for this message
Edward Hope-Morley (hopem) wrote :

The verification of the Stable Release Update for python-glanceclient has completed successfully and the package has now been released to -updates. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Edward Hope-Morley (hopem) wrote :

This bug was fixed in the package python-glanceclient - 1:3.6.0-0ubuntu2~cloud0
---------------

 python-glanceclient (1:3.6.0-0ubuntu2~cloud0) focal-yoga; urgency=medium
 .
   * New update for the Ubuntu Cloud Archive.
 .
 python-glanceclient (1:3.6.0-0ubuntu2) jammy; urgency=medium
 .
   * d/p/lp2020139.patch: Bump the CHUNKSIZE to
     use CPU more efficiently (LP: #2020139).

tags: added: verification-done
removed: verification-needed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.