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

(Universal) Idling for DevWorkspace based workspaces #20345

Open
l0rd opened this issue Aug 23, 2021 · 15 comments
Open

(Universal) Idling for DevWorkspace based workspaces #20345

l0rd opened this issue Aug 23, 2021 · 15 comments
Labels
engine/devworkspace Issues related to Che configured to use the devworkspace controller as workspace engine. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@l0rd
Copy link
Contributor

l0rd commented Aug 23, 2021

Is your enhancement related to a problem? Please describe

Workspaces controlled by the che-server are shut down when inactive for a specific period of time (specified by the customCheProperty CHE_LIMITS_WORKSPACE_IDLE_TIMEOUT) but there is no way at the moment to automatically shut down Workspaces controlled by the devworkspace operator.

Describe the solution you'd like

Workspaces idling should work with DevWorkspaces too. A possible solution would be to use a mechanism similar to Knative autoscaling system: expose workspaces activity metrics (e.g. editor requests per second) and at che-server level collect those metrics and decide which DevWorkspaces need to be scaled to zero.

Activity metrics should be exposed by editors (theia, jetbrains, vscode) extensions.

Scale to zero for workspaces without an editor or for workspaces with an editors but without metrics is out of the scope of this epic.

Describe alternatives you've considered

Currently the Web Terminal supports idling using activity ticks sent from the Console to the machine-exec activity rest API. This approach has a few drawbacks: couples machine-exec and the component that tracks the activity, machine-exec requires privileges to scale the dw to zero.

@l0rd l0rd added kind/enhancement A feature request - must adhere to the feature request template. kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed. roadmap/3-months Epics that are planned to complete in the short term (within 3 months) labels Aug 23, 2021
@l0rd l0rd added area/che-server engine/devworkspace Issues related to Che configured to use the devworkspace controller as workspace engine. labels Aug 23, 2021
@l0rd
Copy link
Contributor Author

l0rd commented Aug 30, 2021

We had a call this morning where we discussed what's the best Che component to handle that. Here is a summary:

I am against making the DevWorkspace operator responsible for idling workspaces. I would like the DevWorkspace to be as simple as possible and to only be responsible to transforms devfiles into k8s objects. It should not be multi-tenant and should not manage user workspaces (creating, updating, deleting DevWorkspace CRs): those are responsibilities of the server-side components.

@skabashnyuk doesn’t want it to be part of the che-server because he considers that we are not investing in that Java code anymore and the che-server is not cloud native anyway. It should rather be a responsibility of the Che operator that currently manages workspaces namespaces.

@sleshchenko doesn't know what's the ideal solution but delegating idling to an operator may not be the best option: that's not about reconciling custom resources and that's what controllers should do.

@tolusha what's your opinion?

@tolusha
Copy link
Contributor

tolusha commented Sep 1, 2021

For me it is strange to delegate this to che-operator. As you said:

hat's not about reconciling custom resources and that's what controllers should do.

@sleshchenko
Copy link
Member

Just to share. I looked a bit on the implementation for the referenced https://knative.dev/docs/serving/autoscaling/ and they really have operator-based approach.
As far as I understand:

If we go with Server approach, we still need to store somewhere the usage information. The simplest solution without database - configmap, but it may look a bit weird.

@l0rd
Copy link
Contributor Author

l0rd commented Sep 3, 2021

Is using knative PodAutoscaler, and not re-implementing something similar, an option?

@benoitf benoitf removed the kind/enhancement A feature request - must adhere to the feature request template. label Sep 7, 2021
@sleshchenko
Copy link
Member

As we agreed on today's DevWorkspace Cabal, this issue is not in milestone 3 anymore, but instead, we'll implement (in 3rd Milestone) quick solution on Theia + Machine Exec side #20460.

This issue is relevant and we see the value on stopping by inactivity on Che side, regardless editor that is used.
Our team will do investigation/prepare proposal where exactly this mechanism will live and how flow with work.

@benoitf
Copy link
Contributor

benoitf commented Sep 22, 2021

An API only in chrome
https://chromestatus.com/feature/4590256452009984

@l0rd l0rd changed the title Idling for DevWorkspace based workspaces (Universal) Idling for DevWorkspace based workspaces Sep 29, 2021
@l0rd l0rd removed this from the DevWorkspace Integration - STEP3 milestone Oct 4, 2021
@l0rd
Copy link
Contributor Author

l0rd commented Oct 4, 2021

Removed from DevWorkspace Integration - STEP3 milestone

@l0rd l0rd removed kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed. roadmap/3-months Epics that are planned to complete in the short term (within 3 months) labels Oct 5, 2021
@l0rd
Copy link
Contributor Author

l0rd commented Oct 5, 2021

Removed the kind/epic label as that's a subtask of the epic Production-ready support of VS Code as a Che editor #20500

@che-bot
Copy link
Contributor

che-bot commented Apr 3, 2022

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 3, 2022
@che-bot che-bot closed this as completed Apr 10, 2022
@l0rd l0rd added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 11, 2022
@l0rd l0rd reopened this Apr 11, 2022
@karatkep
Copy link

karatkep commented May 7, 2023

Hello @l0rd, @nickboldt, @tolusha, @ibuziuk .

Just to make it clear: is there any way to shut down DevWorkspace after some time of user inactivity? I tried to play with both secondsOfInactivityBeforeIdling and secondsOfRunBeforeIdling but without luck 😞

@l0rd
Copy link
Contributor Author

l0rd commented May 9, 2023

It's implemented and working for VS Code but not for JetBrains IDE yet. The component that is responsible to track the IDE activity and stop the workspace is machine-exec that is copied in a volume and executed at workspace startup.

@karatkep
Copy link

karatkep commented May 9, 2023

Thank you @l0rd !

Could you please share how to use machine-exec container in the right way with VS Code? Any sample.

Thanks in advance!

@l0rd
Copy link
Contributor Author

l0rd commented May 9, 2023

There is nothing particular to do if you use Eclipse Che definition of VS Code:

@karatkep
Copy link

Thank you very much @l0rd for detailed explanation!

@l0rd
Copy link
Contributor Author

l0rd commented Oct 12, 2023

This is on hold until we start using JetBrians Gateway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine/devworkspace Issues related to Che configured to use the devworkspace controller as workspace engine. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Development

No branches or pull requests

9 participants