-
-
Notifications
You must be signed in to change notification settings - Fork 239
!!! FEATURE: Allow workspaces to be deactivated, leaving them unusable until being activated again #5718
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
base: 9.0
Are you sure you want to change the base?
Conversation
7523b84 to
b6569c4
Compare
… being activated again This allows removing the associated content stream and therefore all entries from the HierachyRelation table related it until the workspace is activated again.
b6569c4 to
b4c70c9
Compare
|
Hey everybody, this change was done by my colleague @sachera in close coordination with me. I think it will help us a lot to improve perceived performance. Curious about your reviews @bwaidelich @nezaniel @kitsunet @Sebobo @dlubitz @mhsdesign :) FYI @sachera is working on getting the linter green, just some final adjustments. All the best, |
|
from @mhsdesign: Thanks for that you two:) Great to see some new wind and new problems being solved! Ill have to review this in depth but i read the description. There seems now explicit activation and deactivation involved. Do you remember the idea of forking a workspace during the first write operation on it instead? And respectively after a full publish a workspace would remove its contentstream again and all read operation happen on the base workspace? I was just wondering if this wouldnt make the workspace being used from the outside much simpler and we dont need the cronjob. Because if now a stale user logs in id assume their workspace is reactivated which causes a new fork event and which slows down the login to Neos ui so much that its considered frozen. Also the user might not even want to edit content if its an administrator but might just want to manage users in the user module - so preparing the workspace is not always sensible. Creating the fork only at first time of write can be better visualised via ajax and a dialog with loading indicator. |
|
Hey @mhsdesign :)
Yes, we also evaluated this, and the following reasons were in our opinion against this:
-> and we tried to find a good pragmatic, but still fitting to the existing architecture, solution :) All the best, Sebastian |
|
Hi thx for coming up with that! Though it feels a bit more like a bandaid this way for a problematic situation. Most projects wouldn't activate the cron job probably, as it is "fast" in the beginning and only over time when they add more users or create new workspaces, it becomes slower and maybe nobody would think that this is the reason or the customer wouldn't call the agency, to say: hey turn of on the workspace disabling 😉. I hope you know what I mean. So this is like a very niche "pro"-feature IMO. I already asked in previous discussions, why we need to update all workspaces all the time. This change goes into the same direction. So my question would be now: Why can't we detect "stale" workspaces on-the-fly? Maybe we can use the "stale" mechanism for both of these things, but have a smarter way of when to set the "stale" flag or whatever we use for that. And an important note: always make sure to handle duplicate events during login, as the login takes time, people reload or whatever and we've had some issues in the past with that and had to fix the event stream by hand on neos.io. |
|
@skurfuerst thanks for your response
id say we should not praise our current solution. A rebase, reactivation or any heavy interaction during the backend load is disruptive for our users. The solution works for a small demo but already with our Neos.io a login takes many seconds before succeeding. Id really like to find a good solution and it should be in line on what we work on here.
granted, that might be too much of magic for the low level content repository - primarily because due to the implementation time is a big factor. Otherwise id say from an API it would fit our workspace to content stream design. Overall i agree that workspaces where there hasnt been any write activity on should not explicitly store all hierarchy relations in the database. An process where the outer layers e.g. Neos.Ui heavily interact with the CR would be: new user created
user becomes stale
TLTR: In Neos 9 we removed the hard coupling from the workspace to user relation. So if we want to implement some workspaces that are not real workspaces we could just remove the workspace and in other parts of the system - e.g. NeosUi handle that by reading from the base. That way we wouldnt break anything in our Core layers, e.g. no new Events/Commands/... changed read models. It would be the total opposite of what i described earlier with the magic Workspace model which might or might not own a content stream. Lets see where the discussion will take us ^^ |
|
IMO "Workspace becomes stale" > "User becomes stale". If we only check the personal workspace a project might still have 200 non-personal workspaces. Neos itself could then do some additional magic to make the personal workspaces more responsive if needed e.g. refresh them when it can anticipate the need. |
|
I'm a bit torn between a proper™ solution like suggested by @mhsdesign and @Sebobo and some intermediate solution that improves the situation earlier..
|
|
I agree with all your thoughts generally, though I very much suggest to improve the situation now/soon; and that is why I uphold the PR suggestion above as the imho best way to go forward with right now. Imho we can combine this in the next steps with content streams prepared for later usage etc. I feel we sometimes fall into the trap "it must be the perfect solution, otherwise we rather have no solution at all"... Personally I won't be able to work on totally different options outlined here for the foreseeable future, so does anybody of you want to pick up this topic? :-) Does anybody see specific problems with the PR above? I did not see any yet from the discussion so far. All the best, |
The only potential issue I see (after skimming over it) is the new event types (because it's a breaking change strictly speaking and because it makes this design choice harder to change in the future). I wonder if this could be made an implementation detail of the dbal adapter instead. But I totally agree to your suggestion to rather improve the situation than trying to come up with the perfect solution that will never be done :) |
|
Hm @bwaidelich , Good question about the new event types. I was thinking that we need to make this behavior visible at the outside - because otherwise we would need to "magically" materialize content streams even before changing things. otherwise our logic for validating constraints and eventual consistency with sequence numbers will fail - at least if I am not mistaken. My first idea was to make this completely transparent, but I could not pull this off in my head 😬 Curious about your thoughts :) |
|
This PR breaking the API and introducing new events as well as the schema adjustments is not something i would expect in a patch level release. Technically the PR looks good though i see already in code the new deactivated state results in some odd phpstan hints and added complexity. Instead as pointed out above Neos.Neos could just remove the user workspaces when they are considered stale which leads to the same state we already have. That means We already have that state in the life cycle of a user - so before adding a whole new concept like shown here i think a few lines to remove the user workspace if stale would have the same effect and is not breaking at all and trivial to review. To also fix the freeze in the login we probably have to go further like outline here #5718 (comment) but this change did not account for this as well. So as an equivalent solution i would suggest: new user created
user becomes stale
one part in this process is new the other steps already exists, and all backend modules need to handle already that a user doesnt own a workspace yet as Neos 9.0 doesnt provide a guarantee. later we extend the process as i outlined above with the Neos Ui only creating the workspace if write was requested. in performance the suggested flow is not worse than 9.0 (which is already bad:D) but also not worse or better than this pr. There is one slight difference to removing and recreating a workspace than to reactivate and deactivate it. The additional neos workspace metadata like title, description, and roles are lost. So in case we hold that information dear we can possibly implement an activation or deactivation on Neos side. But for now the removal should do well: This can be implemented as easy as adjusting I see how many adjustments in the core are needed to implement deactivation there. We put a lot of effort into moving Neos metadata outside the core to the Neos WorkspaceService to simplify it. I think if we need a concept like this it should be part of the Neos WorkspaceService but at the core its simplest if a Workspace exists or doesnt - we also didnt end up introducing virtual workspaces or names because there is just too much complexity involved. Thank you both for drafting out this big pr with the pretty tests and all the things:) And shame on me for tearing it apart? I hope you find the proposed compromise a good start? |
This is meant to address Neos performance issues when publishing changes.
This change modifies the database (
workspace::currentContentStreamIdbecomes nullable) -> that's why it is marked as BREAKINGBasic Idea
Each Neos account has its own workspace and each workspace its own content stream. These content streams result in a potentially large number of entries in the content repositories
hierarchyrelationtable, which in turn, will make the fork operation slower.Core Observation: In a lot of cases only a small amount of these accounts is actually actively used, i.e. have unpublished changes.
The basic idea of this PR is to remove the unnecessary lines from the
hierarchyrelationtable:Implementation Details
The feature is exposed through commands in the
WorkspaceCommandController:./flow workspace:deactivate: deactivate a workspace (only if contains no changes + no other one depending on it)./flow workspace:activate: re-activate a workspace./flow workspace:deactivateStale: deactivate all stale user workspaces. A workspace is stale if:The last command is meant to be used in a cron job or similar to minimize the amount of active workspaces without the need to manually deactivate workspaces.
Checklist
FEATURE|TASK|BUGFIX!!!and have upgrade-instructionsRelated: #4388