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

Separate Ingress from Worker role #2209

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tillrohrmann
Copy link
Contributor

This commit separates the ingress from the worker role. To support backward compatibility this feature is not yet turned on by default and users need to enable it explicity via experimental-feature-enable-separate-ingress-role to be able to configure the ingress role separately. When enabled, users can place the ingress role on a set of freely chosen nodes.

This fixes #1312.

Copy link
Contributor

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

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

LGTM! I left a really minor comment regarding where to handle compatibility. I think (might be wrong) it will be cleaner if we automatically start the ingress role if the worker role is set and feature flag is not set. Instead of still manage ingress from inside the worker.

Then dropping the experimental feature will require change in only one file

Comment on lines 229 to 237
let ingress_role = if config
.ingress
.experimental_feature_enable_separate_ingress_role
&& config.has_role(Role::Ingress)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the ingress role also be create if the feature is not set but this node has a Worker role ? so it's backward compatible ?

Comment on lines 145 to 170
// todo remove once the safe fallback version supports the Ingress role
let ingress_http = if config
.ingress
.experimental_feature_enable_separate_ingress_role
{
None
} else {
// TODO sort this out!
// it's on https://github.com/restatedev/restate/pull/2172
let partition_routing_refresher =
PartitionRoutingRefresher::new(metadata_store_client.clone());

let rpc_router = ConnectionAwareRpcRouter::new(router_builder);
// http ingress
Some(HyperServerIngress::from_options(
&config.ingress,
RpcRequestDispatcher::new(PartitionProcessorRpcClient::new(
networking.clone(),
rpc_router,
metadata.updateable_partition_table(),
partition_routing_refresher.partition_routing(),
)),
metadata.updateable_schema(),
ingress_health_status,
))
};
Copy link
Contributor

@muhamadazmy muhamadazmy Nov 4, 2024

Choose a reason for hiding this comment

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

I am wondering if this should be done in crates/node/src/lib.rs instead? By automatically starting the ingress Role the worker will not have to know/handle this case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think this makes a lot of sense. Thanks for catching this :-) I will update the PR accordingly.

Copy link
Contributor

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

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

Will look at this in depth tomorrow.

@@ -48,6 +48,7 @@ pub enum Role {
MetadataStore,
/// [IN DEVELOPMENT] Serves a log server for replicated loglets
LogServer,
Ingress,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe better to name this HttpIngress in case we ever split the Kafka ingress?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update it.

This commit separates the ingress from the worker role. To support backward
compatibility this feature is not yet turned on by default and users need
to enable it explicity via `experimental-feature-enable-separate-ingress-role`
to be able to configure the ingress role separately. When enabled, users can
place the ingress role on a set of freely chosen nodes.

This fixes restatedev#1312.
@slinkydeveloper
Copy link
Contributor

To support backward compatibility this feature is not yet turned on by default and users need to enable it explicity via experimental-feature-enable-separate-ingress-role to be able to configure the ingress role separately

I wonder if this is needed/worth doing at all. I expect no user setting up roles now anyway, because we never released the distributed runtime :)

@tillrohrmann
Copy link
Contributor Author

I wonder if this is needed/worth doing at all. I expect no user setting up roles now anyway, because we never released the distributed runtime :)

I wanted to make the behavior controllable. W/o the flag and just checking for either of the roles or both, the cluster behavior would change when going back from the next version to this version (assuming we check for either role, then we would start spawning ingresses where ever a worker role is running). W/ the flag, one can choose whether the old behavior (colocation-with workers) or the new ingress role is desirable.

@slinkydeveloper
Copy link
Contributor

Ok my bad, you're right we need the flag, my understanding was this change is not a storage change, but it is because we write in the nodes configuration the roles. gonna do another pass now

Copy link
Contributor

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

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

LGTM, just a typo in the copyright header.

I assume I don't need to change anything in the sdk test suite right?

@@ -1,4 +1,4 @@
// Copyright (c) 2024 - Restate Software, Inc., Restate GmbH.
// Copyright (c) 2024-2024 - Restate Software, Inc., Restate GmbH.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Copyright (c) 2024-2024 - Restate Software, Inc., Restate GmbH.
// Copyright (c) 2024-2024 = 0 - Restate Software, Inc., Restate GmbH.


type IngressHttp<T> = HyperServerIngress<Schema, RpcRequestDispatcher<T>>;

pub struct IngressRole<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

carrying this T around is soooo annoying and leaky 😢

ingress_http: IngressHttp<T>,
}

impl<T: TransportConnect> IngressRole<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split ingress role from worker role
3 participants