|
| 1 | +--- |
| 2 | +title: Migration Stream Compression inside XenGuest |
| 3 | +layout: default |
| 4 | +design_doc: true |
| 5 | +revision: 1 |
| 6 | +status: proposed |
| 7 | +--- |
| 8 | +# Migration Stream Compression inside XenGuest |
| 9 | + |
| 10 | +To reduce VM migration time, we want to compress the VM migration data |
| 11 | +stream. This document describes a new approach that might replace an |
| 12 | +existing feature, described first below. |
| 13 | + |
| 14 | +## Existing Stream Compression |
| 15 | + |
| 16 | +Xapi implements external migration stream compression. This uses an |
| 17 | +external zstd process each to compress (source) and decompress |
| 18 | +(destination) the VM and GPU streams, restively. The compression is |
| 19 | +transparent to the underlying daemons like XenGuest and vgpu/demu. It is |
| 20 | +controlled by an optional boolean parameter `compress` to the VM.migrate |
| 21 | +API/XE call. When not explicitly provided, a boolean pool parameter |
| 22 | +`Pool.migration_compression` is used. The current default (false) is to |
| 23 | +not use use compression for migration. A pool-level default simplifies |
| 24 | +managing the policy to use for migration compared to a host-level |
| 25 | +default. |
| 26 | + |
| 27 | +This feature requires to communicate the use of compression to the |
| 28 | +receiving host such that it can set up the decompression; this is done |
| 29 | +using cookies. Both VM and GPU memory is compressed during VM migration. |
| 30 | + |
| 31 | +Benchmarking found that this compression scheme is only beneficial when |
| 32 | +using slow networks (like 10Gb Ethernet). It comes with considerable |
| 33 | +internal overhead from using processes and pipe communication for the |
| 34 | +compression and decompression work. That is the reason stream |
| 35 | +compression is not enabled by default. |
| 36 | + |
| 37 | +The main implementation of the feature (with some changes added later) |
| 38 | +is in commit: |
| 39 | + |
| 40 | +* f14fb91137197f24a4784612dd0f2d863ee22fb1 |
| 41 | +* CP-39640/CP-39157 Add stream compression for VM migration |
| 42 | + |
| 43 | +## XenGuest-based Stream Compression |
| 44 | + |
| 45 | +This design is about adding an alternative stream compression. This one |
| 46 | +is implemented inside XenGuest such that the stream it produces is |
| 47 | +internally using compression. XenGuest is not using an external process |
| 48 | +for this and hence incurs less overhead because no process |
| 49 | +intercommunication is required. Benchmarking confirmed the performance |
| 50 | +advantage of this architecture. |
| 51 | + |
| 52 | +The use of compression on the source side needs to be signaled by |
| 53 | +Xenopsd via a command line argument to emu0manager and XenGuest. On the |
| 54 | +receiving side XenGuest will recognise the compressed stream and does |
| 55 | +not require special signaling. |
| 56 | + |
| 57 | +Xapi only permits migration from older to newer versions of the Xapi |
| 58 | +Toolstack. This implies that no older XenGuest version will ever receive |
| 59 | +a potentially compressed stream that it would not be equipped to handle. |
| 60 | +For backward compatibility, xapi still needs to be able to receive a |
| 61 | +compressed migration stream using external compression - even if future |
| 62 | +Xapi implementation chose no longer to create them. |
| 63 | + |
| 64 | +Currently only the stream created by XenGuest would use compression, but |
| 65 | +not the stream containing GPU data created by vgpu/demu. This might |
| 66 | +change in the future when we decide to implement in-stream compression |
| 67 | +there, too. |
| 68 | + |
| 69 | +Theoretically, internal compression implemented in XenGuest and existing |
| 70 | +external compression are independent and could be used both. However, |
| 71 | +this would apply a compression to an already compressed stream, which is |
| 72 | +unlikely to be effective and we don't plan to support this feature. |
| 73 | + |
| 74 | +## API Design |
| 75 | + |
| 76 | +* VM.pool_migrate API and `xe vm-migrate` remain unchanged. Both accept |
| 77 | + an optional boolean value that indicates whether to use compression or |
| 78 | + not. In the absence of this parameter, the default is taken from |
| 79 | + `Pool.migration_compression` (which is currently `false`). |
| 80 | + |
| 81 | +* The compression method used when `Pool.migration_compression=true` is |
| 82 | + *not* controlled by the API or the customer but is controlled by a |
| 83 | + default in xenopsd which can be changed in xenopd.conf for testing. |
| 84 | + |
| 85 | +In summary, this means the API and XE CLI interface remain unchanged. |
| 86 | + |
| 87 | +## Implementation |
| 88 | + |
| 89 | +Outside the changes described here, the following other components are |
| 90 | +affected: |
| 91 | + |
| 92 | +* EMU Manager needs to accept a new flag to indicated that compression |
| 93 | + is used during migration. |
| 94 | + |
| 95 | +* XenGuest needs to accept a flag passed by EMU Manager to use |
| 96 | + compression. |
| 97 | + |
| 98 | +## Upgrade |
| 99 | + |
| 100 | +Xapi will always accept stream/external compressed migration streams but |
| 101 | +might stop using them for migration. |
| 102 | + |
| 103 | +## Outlook |
| 104 | + |
| 105 | +* We might add internal compression to vGPU migration in the future. The |
| 106 | + API would be unaffected by this. |
| 107 | + |
| 108 | +* The current design forces all destinations to accept all compression |
| 109 | + streams because compatibility is not negotiate between source and |
| 110 | + destination. This is a general problem and not limited to compression. |
| 111 | + We could expose a general table to clients that lists features |
| 112 | + supported by xenopsd such that any other xenopsd would send data in |
| 113 | + the preferred format. |
0 commit comments