Skip to contentSkip to conversation

When does live migration give up?

Qemu-devel Alex Bligh 2 participants 6 messages Sep 4, 2013

lore
Share & tools
lore

Alex Bligh

author
#0 lore raw

We have seen a situation when migrating about 50 VMs at once where some of them fail. I think this is because they are dirtying pages faster than they can be transmitted.

What algorithm controls when migration fails in this way, and is it tunable?

I am fully aware one answer to this question is "do not attempt to migrate 50 busy VMs through a single 1GB/s NIC".

Signature · 1 line
Alex Bligh
#1 lore raw

Il 04/09/2013 17:24, Alex Bligh ha scritto:

Quoted 3 lines

We have seen a situation when migrating about 50 VMs at once where some of them fail. I think this is because they are dirtying pages faster than they can be transmitted.

No, migration never "gives up". It may never converge, but it keeps trying until cancelled.

Could it be that you are choosing migration server ports from a small range, and some of them are failing because two migrations pick the same random port for the destination (which is where the server socket lies)?

Paolo

Quoted 5 lines

What algorithm controls when migration fails in this way, and is it tunable?

I am fully aware one answer to this question is "do not attempt to migrate 50 busy VMs through a single 1GB/s NIC".

author
#2 lore raw

Paolo,

Quoted 11 lines · --On 4 September 2013 19:07:53 +0200 Paolo Bonzini <[email protected]> wrote:

Il 04/09/2013 17:24, Alex Bligh ha scritto:

Quoted 3 lines

We have seen a situation when migrating about 50 VMs at once where some of them fail. I think this is because they are dirtying pages faster than they can be transmitted.

No, migration never "gives up". It may never converge, but it keeps trying until cancelled.

Could it be that you are choosing migration server ports from a small range, and some of them are failing because two migrations pick the same random port for the destination (which is where the server socket lies)?

Should not be that. We create FDs (which are sockets) and pass them in at both ends. Approx 10% of migrations die after many minutes on the customer's platform. This does not appear to happen if migrations are not carried out 50 at a time.

We appear to be getting something other than 'ms' returned through the monitoring system. Unhelpfully what that is is not logged.

Is there anything (apart from the socket closing prematurely) which can cause a failed migration after many minutes? We've seen problems where the destination is not set up the same as the source (e.g. different numbers of NICs) but IIRC that fails much earlier.

To make things easier (cough), this is qemu 1.0 (as shipped with Ubuntu Precise).

Signature · 1 line
Alex Bligh
#3 lore raw

Il 04/09/2013 20:05, Alex Bligh ha scritto:

Quoted 14 lines

Paolo,

--On 4 September 2013 19:07:53 +0200 Paolo Bonzini <[email protected]>

Quoted 9 lines · wrote:

Il 04/09/2013 17:24, Alex Bligh ha scritto:

Quoted 4 lines

We have seen a situation when migrating about 50 VMs at once where some of them fail. I think this is because they are dirtying pages faster than
they can be transmitted.

No, migration never "gives up". It may never converge, but it keeps trying until cancelled.

Quoted 6 lines
Quoted 3 lines

Could it be that you are choosing migration server ports from a small range, and some of them are failing because two migrations pick the same random port for the destination (which is where the server socket lies)?

Should not be that. We create FDs (which are sockets) and pass them in at both ends.

Do you mean something like this?

destination
socket()
bind() to { sin_port = 0, sin_addr.s_addr = INADDR_ANY } listen()
getsockname()
send address to source
accept()
start QEMU with file descriptor returned by accept

source
read address
socket()
connect()
pass socket file descriptor to QEMU and migrate to it

Anything that doesn't use sin_port = 0 and getsockname() is prone to race conditions.

Quoted 3 lines

Approx 10% of migrations die after many minutes on the customer's platform. This does not appear to happen if migrations are not carried out 50 at a time.

Dying after many minutes usually means that the destination is not set up the same as the source, as you said below.

Paolo

Quoted 11 lines

We appear to be getting something other than 'ms' returned through the monitoring system. Unhelpfully what that is is not logged.

Is there anything (apart from the socket closing prematurely) which can cause a failed migration after many minutes? We've seen problems where the destination is not set up the same as the source (e.g. different numbers of NICs) but IIRC that fails much earlier.

To make things easier (cough), this is qemu 1.0 (as shipped with Ubuntu Precise).

author
#4 lore raw

Paolo,

Quoted 12 lines

Do you mean something like this?

destination
socket()
bind() to { sin_port = 0, sin_addr.s_addr = INADDR_ANY } listen()
getsockname()
send address to source
accept()
start QEMU with file descriptor returned by accept

Quoted 8 lines

source
read address
socket()
connect()
pass socket file descriptor to QEMU and migrate to it

Anything that doesn't use sin_port = 0 and getsockname() is prone to race conditions.

From memory we bind() to a specific randomly chosen port and if that fails retry until bind() succeeds. This is because we want the port to be within a given range. I believe that is race free as only one bind() can run at once.

Quoted 6 lines
Quoted 3 lines

Approx 10% of migrations die after many minutes on the customer's platform. This does not appear to happen if migrations are not carried out 50 at a time.

Dying after many minutes usually means that the destination is not set up the same as the source, as you said below.

Hmmm. OK I thought that produced an immediate error. Is there any way of logging what's up to stderr or similar etc?

Alex

Quoted 17 lines

Paolo

Quoted 11 lines

We appear to be getting something other than 'ms' returned through the monitoring system. Unhelpfully what that is is not logged.

Is there anything (apart from the socket closing prematurely) which can cause a failed migration after many minutes? We've seen problems where the destination is not set up the same as the source (e.g. different numbers of NICs) but IIRC that fails much earlier.

To make things easier (cough), this is qemu 1.0 (as shipped with Ubuntu Precise).

Signature · 1 line
Alex Bligh
author
#5 lore raw
In reply to Alex Bligh
Quoted 2 lines · --On 4 September 2013 19:05:50 +0100 Alex Bligh <[email protected]> wrote:

We appear to be getting something other than 'ms' returned through the monitoring system. Unhelpfully what that is is not logged.

By which I mean 'we seem to be getting "status: failed" on the send side'

Signature · 1 line
Alex Bligh