Migrating an offline VM disk between two local SRs is slow
-
@olivierlambert This is all offline. Unfortunately I can't describe exactly what was done, since someone else was doing the work and they were trying a bunch of different things all in a row. I suspect that the apparently fast migration is a red herring (maybe a previous attempt left a copy of the disk on the destination SR, and the system noticed that and avoided the actual I/O?) but if there turned out to be a magical fast path, I wouldn't complain!
-
You can also try warm migration, which can go a lot faster.
-
Using XOA "Disaster Recovery" backup method can be a lot faster than normal offline migration.
One time I did it, it took approx 10 minutes instead of 2 hours...
-
I think I am seeing a similar issue. Raid1 NVME copy to raid 10 4x2tb HDD on same host
a 300gb transfer is estimated at 7 hours. (11% done in 50 mins)
the vm is live.
according to the stats almost nothing is happening on this server or the 2 storage
-
@olivierlambert
Is the CPU on the sending host or the receiving host the limiting factor for single disk migrations? -
I can't really tell, gut feeling is the sending host, but I have no numbers to confirm.
-
@Davidj-0 in my case there CPU activity is minimal. I think something is wrong with the software raid 10 setup. On an identical setup warm migration between to the raid 10 array between hosts is showing horrible iowait similar to the sr to sr transfer on the other host

-
Maybe the IO scheduler is not the right one?
-
@olivierlambert
I think I found the root cause of the slow Storage Migration performance I reported above.After tracing
sparse_dd, the issue appears to be an interaction between Nagle's algorithm and TCP delayed ACKs on the NBD connection.With
strace, I found thatsparse_ddsends the NBD request header and payload using separatewrite()calls:write(fd, <NBD header>, 28) = 28 write(fd, <data>, 2097152) = 2097152 read(fd, <NBD reply>, 16) = 16Normally this is fast, but there are also periodic 512-byte requests:
write(fd, <NBD header>, 28) = 28 write(fd, <data>, 512) = 512 ~40 ms delay read(fd, <NBD reply>, 16) = 16During these stalls,
ss -tinpshowed:ato:40 unacked:1 notsent:512This seems to produce the following sequence:
- The 28-byte NBD header is sent.
- It remains unacknowledged.
- The following 512-byte payload is queued.
- Nagle's algorithm prevents that small payload from being sent while the previous data is unacknowledged.
- The peer's delayed ACK timer expires after approximately 40 ms.
- The ACK arrives and the 512-byte payload is finally transmitted.
I also checked a packet capture. The destination iSCSI write only occurred after this delay, so the storage itself was not causing the 40 ms stall.
To verify this before modifying the package, I attached GDB to the running
sparse_ddprocess and enabledTCP_NODELAYwithsetsockopt()on its existing TCP socket.The effect was immediate: the
notsent:512stalls disappeared and migration throughput increased substantially.I then patched
ocaml/vhd-tool/src/impl.ml.The current code is:
let socket sockaddr = let family = match sockaddr with | Lwt_unix.ADDR_INET (addr, port) -> Unix.domain_of_sockaddr (Lwt_unix.ADDR_INET (addr, port)) | Lwt_unix.ADDR_UNIX _ -> Unix.PF_UNIX in Lwt_unix.socket family Unix.SOCK_STREAM 0I changed it to enable
TCP_NODELAYfor TCP sockets:--- a/ocaml/vhd-tool/src/impl.ml +++ b/ocaml/vhd-tool/src/impl.ml @@ - Lwt_unix.socket family Unix.SOCK_STREAM 0 + let sock = Lwt_unix.socket family Unix.SOCK_STREAM 0 in + ( match sockaddr with + | Lwt_unix.ADDR_INET _ -> + Lwt_unix.setsockopt sock Unix.TCP_NODELAY true + | Lwt_unix.ADDR_UNIX _ -> + () + ) ; + sockI rebuilt
vhd-toolfor XCP-ng 8.3 and tested Storage Migration again.Before the patch, I was consistently seeing only around:
30-40 MB/sAfter enabling
TCP_NODELAY, I am seeing roughly:150-300 MB/sdepending on storage activity.
For example, during one test:
eth2: ~174 MB/s eth3: ~174 MB/s lo: ~320 MB/sand there were also physical-interface peaks around 300 MB/s.
After the patch,
ssstill showsato:40, which is expected because delayed ACK is still enabled on the peer:rtt:0.059/0.017 ato:40 ... unacked:1but the important difference is that the persistent:
notsent:512is gone, so the delayed ACK timer no longer stalls the NBD payload.
I also checked the upstream
xen-apiv26.1.16 source, and the socket creation code still does not enableTCP_NODELAY.So I believe this explains the ~30-40 MB/s limitation I was seeing with
sparse_ddNBD Storage Migration.Would it make sense to enable
TCP_NODELAYfor theADDR_INETsocket invhd-toolupstream? -
Worth mentioning @Team-Storage
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login