Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make external hostname in executor optional #232

Merged
merged 2 commits into from
May 2, 2021

Conversation

edrevo
Copy link
Contributor

@edrevo edrevo commented May 1, 2021

Which issue does this PR close?

Closes #76.

Rationale for this change

From the issue:

Having the ability to set an external/advertised hostname is great since it provides users a lot of flexibility in network deployments. However, having it a required argument is a pain for the most common scenario, where the scheduler, client and executors talk to each other in the same network (e.g. k8s or docker-compose).

We should make the external hostname optional. If the scheduler receives executor metadata without a hostname, it should register the caller's IP address as the hostname.

This will make it easier to deploy the executors as a kubernetes deployment, or to docker-compose scale ballista-executor= in the integration tests.

What changes are included in this PR?

  • Make hostname optional upon executor registration
  • Removed a bunch of old code in the planner

Are there any user-facing changes?

Advertised hostname is now optional when launching the executor.

@edrevo
Copy link
Contributor Author

edrevo commented May 1, 2021

cc @andygrove

@@ -62,17 +62,20 @@ async fn start_server(
BALLISTA_VERSION, addr
);

let scheduler_server =
SchedulerServer::new(config_backend.clone(), namespace.clone());
Ok(Server::bind(&addr)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned this code is creating a new server per client. See https://github.com/apache/arrow/pull/9987/files#r624519673

@codecov-commenter
Copy link

codecov-commenter commented May 1, 2021

Codecov Report

Merging #232 (1898ade) into master (c945b03) will increase coverage by 0.24%.
The diff coverage is 27.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #232      +/-   ##
==========================================
+ Coverage   76.46%   76.70%   +0.24%     
==========================================
  Files         135      134       -1     
  Lines       23250    23174      -76     
==========================================
- Hits        17777    17776       -1     
+ Misses       5473     5398      -75     
Impacted Files Coverage Δ
ballista/rust/core/src/client.rs 0.00% <ø> (ø)
...ust/core/src/execution_plans/unresolved_shuffle.rs 50.00% <ø> (ø)
ballista/rust/executor/src/execution_loop.rs 0.00% <ø> (ø)
ballista/rust/executor/src/flight_service.rs 0.00% <0.00%> (ø)
ballista/rust/executor/src/main.rs 0.00% <0.00%> (ø)
ballista/rust/scheduler/src/main.rs 0.00% <0.00%> (ø)
ballista/rust/scheduler/src/planner.rs 69.46% <50.00%> (+23.53%) ⬆️
ballista/rust/scheduler/src/lib.rs 21.13% <88.88%> (+1.62%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c945b03...1898ade. Read the comment docs.


let server = FlightServiceServer::new(service);
info!(
"Ballista v{} Rust Executor listening on {:?}",
BALLISTA_VERSION, addr
);
let server_future = tokio::spawn(Server::builder().add_service(server).serve(addr));
let client = BallistaClient::try_new(&external_host, port).await?;
let client_host = external_host.as_deref().unwrap_or_else(|| {
if bind_host == "0.0.0.0" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what the intent is here. According to https://en.wikipedia.org/wiki/0.0.0.0, binding to 0.0.0.0 means binding to "any IPv4 address at all". This seems to change that behavior and prevents the user from doing that. Perhaps you could add some documentation here to explain this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a comment to clarify. Right now the executor does a really weird thing which has a big TODO here:

https://github.com/apache/arrow-datafusion/blob/70afe4c459af33b8cb190383c923fcee09cde252/ballista/rust/executor/src/execution_loop.rs#L100-L101

Basically, the executor needs to connect to itself through a BallistaClient in order to work. If there is an external host defined, then it is clear how to connect to oneself. If not, we need to check the bind address, but since 0.0.0.0 is a meta-address, for that case we can just use localhost to connect to ourselves. Does that make sense?

I started working on the TODO to get rid of this ugliness, but then the PR would have been too big, so I was planning on tackling that separately.

@andygrove
Copy link
Member

Thanks @edrevo this looks like a good cleanup. I will find time this weekend (likely tomorrow) to pull this PR and do some testing to make sure I understand everything that is happening here.

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @edrevo. I pulled the branch locally and tested running scheduler and executor on separate computers on the same network (in standalone mode - no containerization) and saw the executor register with the scheduler. I didn't run any queries because I'm not set up to be able to do that easily yet.

I like the ability to scale more easily in docker-compose 💯

@andygrove andygrove merged commit 5ecfb1b into apache:master May 2, 2021
@alamb alamb added the ballista label May 3, 2021
@edrevo edrevo deleted the make-hostname-optional branch June 11, 2021 09:35
@houqp houqp added api change Changes the API exposed to users of the crate enhancement New feature or request labels Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make external hostname in executor optional
5 participants