-
Notifications
You must be signed in to change notification settings - Fork 673
Several seconds delay after attaching with re-cycled IP address #441
Comments
Thanks, I can reproduce this. It's due to the ARP (aka neighbour) cache. In your example, when you do You can reduce that time by setting Reducing the reachable time will increase by ARP traffic, although not necessarily by a huge amount because receiving data on a TCP connection prevents the associated ARP mapping from going stale. Changing The ideal solution would be for weave to actively invalidate ARP mappings across the network when a container is detached, but that would be a much more substantial change. |
Reducing btw, when I looked at arp behaviour a while ago, I found this stackoverflow entry most informative. Based on that, it would seem that there is little risk in reducing |
I saw that, but I'm not sure it is entirely accurate, or at least not up to date. In the current kernel source code, I haven't found a mechanism by which route cache entries pin arp/neighbour cache entries. And the statement that "the kernel will sometimes change timeout values based on positive feedback" is fairly vague when it seems to be the key mechanism that prevents arp entries going stale (search for So I think we'd need to confirm experimentally what effect changing |
I'm having this exact issue trying to migrate a container and its IP to another host - anything that has spoken to it in the original location suffers the delay. Can confirm that the moment I A couple of points/questions:
Thanks for this thread - gave me a huge boost to remove the delay and get on with the demo I'm doing :-) |
Thanks. We're very likely to make the weave script set that for the ethwe interface on all containers started with
where
Yes.
No, Linux doesn't actually evict entries from the ARP cache due to that value, it just marks them as stale. So dropping the value then increasing it again won't have much of an effect. |
After a lot of poking containers and looking at the impact on the ARP cache, and comparing the observed behaviour with the kernel code, I've convinced myself that setting I have almost finished writing a long explanation of why this is so, but I'm not going to get that done before the end of the day, and I want to get the PR out today. The "tl;dr" is that the kernel has a intricate mechanism so that, if two IP hosts are communicating using TCP, they usually won't send ARP requests to each other, even if there are periods much longer than |
BTW, if you really want to flush the ARP cache, you can do it with
or you can remove specific entries with
But you might need to do this for any container on the weave network. Ideally, I think weave would do this for all containers on the network whenever a container is detached, but weave doesn't currently distribute such notifications so this is not a small change. |
@dpw thank you so much this is really helpful From my observations getting a demo of a migrating IP to work - setting a value of 5000 on the ethwe interface would be a great change to make. I can't speak for performance under load but in terms of observable latency it works great. Would this remove the need for busting the cache for specific containers? Doing that across a cluster feels like a really hard thing to do. Thanks again :-) |
Oh great: "fix base_reachable_time(_ms) not effective immediatly when changed" torvalds/linux@4bf6980dd032853 |
Hi!
I'm experimenting with attaching/detaching docker containers with weave. It seems pretty consistent that when attaching to an IP that has previously been used (and detached) - even tho the attachment is immediately visible in
weave ps
- it takes quite a few seconds to actually connect. Attaching to new IPs is instant.I was asked to open an issue on here by @rade.
Here is my reproduction. The
luisbebop/echo-server
just echoes back what is sent to it, on port 8800. Thetutum/curl
image is an ubuntu with curl on it.Now, outside of the curl container, detach then attach:
The ps shows that the attachment is in effect, but back inside the curl container:
Takes quite a while. It eventually will work, tho. With a new IP there is no delay.
I am running this on a Ubuntu 14.04 LTS inside virtualbox, if that makes a difference.
The use case I'm looking at is seamless deploys, spinning up a new application container and switching over to it, without other services needing to be restarted/linked. It seems everything is going to be fine untill I run out of new IPs to assign to containers :)
My hope at this point is that it wont be a problem in practice when I cycle through 255 IP addresses. Otherwise I might be able to wait for the attachment to go fully into effect before detaching the old app.
The text was updated successfully, but these errors were encountered: