Repository navigation
Experimental support for P2P Volume Streaming - #6186
Conversation
|
Just wanted to say this caught my interest when looking from perspective of a cache that can be used across workers as requested in #1987 😄 |
41b438c to
4f2d296
Compare
58e0c1c to
f7600e1
Compare
2aec6c8 to
b7081fc
Compare
|
@taylorsilva This PR is ready for review. Code cleaned up and tests added. Please notice that, as two BC endpoints are added, worker version (currently 2.2) should be bumped. |
9e31501 to
35c1333
Compare
|
Pretty dang cool! It sounds like so far this is opt-in and you have to make sure all your workers can reach each other? I wonder if a future iteration could have workers specify their network somehow - maybe just a name to indicate which workers live in the same network. Or maybe this behavior could be tied to pools somehow? 🤔 Anyway this is awesome, thanks for working on it! |
taylorsilva
left a comment
There was a problem hiding this comment.
This works as expected! Ran a simple job with each step running on a different worker. I added a log line in artifact_source so I could confirm that it used the p2pStreamTo().

I just have one nit about adding the tracing calls since streamTo has it. I'd like to keep parity on those functions and will probably help make it easier to get data on how fast p2p streaming is vs through the web node.
My docker-compose file for testing:
version: '3'
services:
db:
image: postgres:${POSTGRES_TAG:-latest}
shm_size: 1gb
ports:
- 6543:5432
environment:
POSTGRES_DB: concourse
POSTGRES_USER: dev
POSTGRES_PASSWORD: dev
web:
build: .
image: concourse/concourse:local
volumes:
- .:/src
command: web
depends_on: [db]
ports:
- 8080:8080
environment:
CONCOURSE_LOG_LEVEL: debug
CONCOURSE_POSTGRES_HOST: db
CONCOURSE_POSTGRES_USER: dev
CONCOURSE_POSTGRES_PASSWORD: dev
CONCOURSE_POSTGRES_DATABASE: concourse
CONCOURSE_EXTERNAL_URL: http://localhost:8080
CONCOURSE_ADD_LOCAL_USER: test:test,guest:guest
CONCOURSE_MAIN_TEAM_LOCAL_USER: test
CONCOURSE_CLUSTER_NAME: dev
CONCOURSE_ENABLE_PIPELINE_INSTANCES: "true"
CONCOURSE_ENABLE_ACROSS_STEP: "true"
worker-1:
build: .
image: concourse/concourse:local
command: worker
privileged: true
depends_on: [web]
stop_signal: SIGUSR2
environment:
CONCOURSE_LOG_LEVEL: debug
CONCOURSE_TSA_HOST: web:2222
# avoid using loopbacks
CONCOURSE_BAGGAGECLAIM_DRIVER: overlay
# so we can reach Garden/Baggageclaim for debugging
CONCOURSE_BIND_IP: 0.0.0.0
CONCOURSE_BAGGAGECLAIM_BIND_IP: 0.0.0.0
CONCOURSE_GARDEN_DNS_PROXY_ENABLE: "true"
CONCOURSE_TAG: worker-1
CONCOURSE_ENABLE_P2P_VOLUME_STREAMING: "true"
worker-2:
build: .
image: concourse/concourse:local
command: worker
privileged: true
depends_on: [web]
stop_signal: SIGUSR2
environment:
CONCOURSE_LOG_LEVEL: debug
CONCOURSE_TSA_HOST: web:2222
# avoid using loopbacks
CONCOURSE_BAGGAGECLAIM_DRIVER: overlay
# so we can reach Garden/Baggageclaim for debugging
CONCOURSE_BIND_IP: 0.0.0.0
CONCOURSE_BAGGAGECLAIM_BIND_IP: 0.0.0.0
CONCOURSE_GARDEN_DNS_PROXY_ENABLE: "true"
CONCOURSE_TAG: worker-2
CONCOURSE_ENABLE_P2P_VOLUME_STREAMING: "true"
@vito In our deployments, all workers can reach each other, so I'll immediately enable this feature once it's available. I have no idea with other deployments, so that I make this feature opt-in. If a cluster administrator knows that all workers can reach each other, then s/he can turn on this feature; otherwise this feature is by default off, innocent by doing nothing.
I have added two worker CLI options in baggage-claim https://github.com/concourse/baggageclaim/blob/v1.9.0/baggageclaimcmd/command.go#L29-L30, which allows to specify which network interface to use for p2p streaming, and IPv4 or v6 to use, which has been good enough for our deployments. If some other deployments' network configuration is more complicated, we may enhance later. Or the user may contribute an enhancement. As the core function is there, such enhancement about configuration should be easy to do. Tied to work pools? Could be a future option. I think potential enhancements could be:
But they are not priorities for our deployments for now. The other thing is, I'm just thinking loudly, once P2P streaming is there, for image fetching, if a worker has the required docker image, while the other worker doesn't have, p2p streaming images locally between workers should be cheaper than fetching it again from DockerHub (as well as other image registries). WDYT? |
|
@taylorsilva I have added the tracing. Please hold on merge this PR for a few days even if you have no more comments. Let me run more tests locally, especially for rainy day cases, like source/target workers crashed during streaming. I'll let you know once my tests are done. |
It doesn't need to block this PR, but I think having some notion of separate networks would be useful. I may be wrong, but I suspect we won't be able to enable this on either CI or hush-house because of our physical Darwin/Windows workers + team-specific external workers in hush-house, despite the fact that the vast majority of the workloads run on workers in the same network Obviously there's no harm in not enabling it, but I'm excited to see the performance gains! |
…directly. Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
b215140 to
e1c98dc
Compare
|
@taylorsilva @vito I have finished my tests. Yesterday I encountered a problem where builds hang up if p2p stream timed out. I tried to debug the issue, and found it hang up in The I found that @vito seems to hit same problem and created a new version |
Signed-off-by: Chao Li <[email protected]>
This test started failing because the retryHttp package was bumped, causing a change in behaviour. Now the test is stuck waiting for `fly watch` to exit, whereas before it would exit after ~5mins retryHttp was bumped in #6186 Existing issue that contains reproducible steps is #3011 Signed-off-by: Taylor Silva <[email protected]>
What does this PR accomplish?
This PR implements P2P Volume Streaming (concourse/rfcs#82). In deployments where workers can reach to each other, P2P Volume Streaming should:
Corresponding baggeclaim part code change is concourse/baggageclaim#39
I have done a PoC. In the PoC, I run the 20 pipelines with the following code:
All pipelines are triggered a 1-minute timer, and a pipeline contains 5 tasks, each task just generate a 50MB random binary file, and is used in next task.
My test cluster has 1 ATC node and 4 workers, using
randomcontainer placement strategy, so that a lot of volume streaming would happen.I ran the test without and with P2P mode each for ~40 minutes. The following metrics shows big performance improvement with P2P mode:
First, let's see build status. The two rounds of test should generate same number of builds. But we can see that, under P2P mode, the test generated more successful builds, which indicates that under P2P mode, build ran faster because of shorter volume streaming time.
Also, let's see volumes streamed. Both tests caused roughly same number of volume streaming.
Then let's difference of ATC cpu/memory/network usages.
We can see that, ATC cpu/memory usages under P2P mode are just roughly 1/3 of non-P2P mode. And the usage curves under P2P mode are smoother and flat-ter, which indicates that ATC under P2P mode should be more stable.
As expected, as volume streaming bits not going through ATC, under P2P mode, ATC's network usage is only at KB level.
Changes proposed by this PR:
Notes to reviewer:
So far the code is still dirty, and tests have not been updated.
EDIT: I have cleaned up the code, so it's ready for review. Please ignore changes in
go.mod,docker-compose.ymlandDockerfile. They ease my local tests, I'll revert them when review is done.EDIT: I have cleaned up all of the code changes, and added test cases. Now this PR is ready for review.
NOTE: With this feature, worker version should be bumped, because two BC endpoints are added, workers must be redeployed, otherwise this feature won't work.
Release Note
--enable-p2p-volume-streamingor env var$CONCOURSE_ENABLE_P2P_VOLUME_STREAMINGon the web nodes. When this feature is enabled,--baggageclaim-bind-ipon workers should be set to0.0.0.0so that baggage claim can be accessed from another workers.--baggageclaim-p2p-interface-name-patternand--baggageclaim-p2p-interface-familyto theworkercommand.Contributor Checklist
Reviewer Checklist
BOSH and
Helm packaging; otherwise, ignored for
the integration
tests
(for example, if they are Garden configs that are not displayed in the
--helptext).