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

perf(sql): Store child pipelines as references #3986

Merged
merged 2 commits into from
Nov 30, 2020

Conversation

robzienert
Copy link
Member

@robzienert robzienert commented Nov 2, 2020

Changes pipeline triggers to be stored as a reference, rather than as the full execution.
This makes individual pipelines smaller to store, trading additional SQL queries to hydrate
the full PipelineExecution.

@@ -830,10 +832,39 @@ class SqlExecutionRepository(
stages.forEach { storeStageInternal(ctx, it, executionId) }
}
} finally {
// Restore original object state.
Copy link
Contributor

Choose a reason for hiding this comment

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

the fact that we need to do this seems a bit wild to me - I wonder if it's worth just objectMapper copying the execution on the way in here so we are free to mutate it as we see fit..

unless the expectation is that the repository mutates to execution to set Ids on it or something...

anyway not super relevate to the overall change in this PR

Copy link
Member Author

Choose a reason for hiding this comment

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

This was an optimization. Saving the execution is a high-throughput (as far as Orca is concerned) operation, and serialization of executions is very high cost.

@cfieber
Copy link
Contributor

cfieber commented Nov 2, 2020

the approach definitely makes sense to me

// throw an exception, we'll continue to load the execution with [PipelineRefTrigger] and let downstream
// consumers throw exceptions if they need to. We don't want to throw here as it would break pipeline list
// operations, etc.
log.error("Attempted to load parent execution for '${execution.id}', but it no longer exists: ${trigger.parentExecutionId}")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would make this a warn so it doesn't show up sentry, etc.
Also, it's not really an error here, as you state. It's an error at a time when someone downstream needs it

@marchello2000
Copy link
Contributor

I remember someone mentioning that some users have (dozens/hundreds?!) parent pipelines. What happens in those cases, does the perf suffer a lot? Otherwise, i think it makes a ton of sense

@robzienert
Copy link
Member Author

robzienert commented Nov 2, 2020

@marchello2000 Perf suffers to the point until where MySQL's (or any SQL's) buffer space runs out -- in some pathological community deployments, people are seeing pipeline payloads going as high as 1GB because of the embedded pipeline trigger. When this buffer space runs out, it causes the query to fail and, as a result, anything in Orca failing since it's an irrecoverable error until someone increases the buffer size... which is not always possible.

@ajordens
Copy link
Contributor

ajordens commented Nov 3, 2020

This is sensible to me.

Changes pipeline triggers to be stored as a reference, rather than as the full execution.
This makes individual pipelines smaller to store, trading additional SQL queries to hydrate
the full `PipelineExecution`.
Copy link
Member Author

@robzienert robzienert left a comment

Choose a reason for hiding this comment

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

This PR is now ready for review.

import com.netflix.spinnaker.orca.pipeline.model.support.mapValue
import com.netflix.spinnaker.orca.sql.pipeline.persistence.PipelineRefTrigger

class PipelineRefTriggerDeserializerSupplier : CustomTriggerDeserializerSupplier {
Copy link
Member Author

Choose a reason for hiding this comment

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

This needed to be made as a CustomTriggerDeserializerSupplier because TriggerDeserializer is in orca-core, whereas PipelineRefTrigger is an implementation detail of orca-sql only.

@robzienert robzienert added the ready to merge Approved and ready for merge label Nov 30, 2020
@mergify mergify bot merged commit cc93ece into spinnaker:master Nov 30, 2020
@mergify mergify bot added the auto merged Merged automatically by a bot label Nov 30, 2020
@dilippai
Copy link

I would encourage the community to not consider use cases like nested pipelines as pathological or abnormal. As Spinnaker adoption grows, especially in the enterprise, you will find usage patterns that are different from yours -- an open source pipelining system needs to be at least somewhat flexible to pipeline patterns that users are naturally likely to gravitate towards.

This is an issue that has become existential for us (Salesforce). I'm not sure why the decision was made to store json as a blob in Orca, but this is leading to huge performance issues culminating in failures.

@Nirmalyasen
Copy link

Since this is reverted back, what is the solution? Is there another PR to address the issue?

This is becoming a big issue. Also, somewhere in 1.20, the no of artifacts produced out of a deployment manifest stage has increased many folds. So, that compounds the issue of child contexts in the pipelines.

KathrynLewis pushed a commit to KathrynLewis/orca that referenced this pull request Jan 31, 2021
Changes pipeline triggers to be stored as a reference, rather than as the full execution.
This makes individual pipelines smaller to store, trading additional SQL queries to hydrate
the full `PipelineExecution`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.24
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants