Comments (3)
A quick look at where the OPA eval happens (I think? Correct me if I'm wrong on this): https://github.com/forseti-security/config-validator/blob/258b9eb9e8e6d6e91da8edbcab771d19ece3fad8/pkg/gcv/cf/cf.go#L214-L222 it appears that the query is passed in as a string for each evaluation. If the actual eval is fast it wouldn't be super surprising to see that a large chunk of time is spent parsing the query on each of the benchmark loop iterations. I see the topdown.eval
entries only taking up a few % on that screenshot so it seems likely that this is the case, especially if the iteration count was large for the benchmark.
More recently in OPA we have added a set of new API's on the rego
package that prepares the rego.Rego
object as a "prepared query" and can then be re-used for evaluations that eliminate the need to do the query prep (and a number of other things, depending on the options passed in). You can then use it with different inputs for evaluations and save a bunch of time, especially on repeated queries where only input is changing (which it looks like in this case here). Check out https://pkg.go.dev/github.com/open-policy-agent/[email protected]/rego?tab=doc#example-Rego.PrepareForEval
Again, just from a quick look. I might have totally missed some other spot that is doing additional parsing.
from frameworks.
@maxsmythe, as discussed, to parse the query ahead of time you'd use https://godoc.org/github.com/open-policy-agent/opa/ast#ParseBody and then use this option to pass in the parsed query https://godoc.org/github.com/open-policy-agent/opa/rego#ParsedQuery
from frameworks.
This has been resolved with #202 and #206 . We only parse Template rego once, and we don't recompile already existing Templates.
from frameworks.
Related Issues (20)
- [bug] `external_data` http request doesn't set `Content-Type` header
- [client.Client] Create optional caching interface for Targets
- Ensure Driver properly handles multi-target deletes
- add dependabot HOT 1
- upgrade opa to 0.38.0 HOT 1
- No Need to Cache Constraint Status HOT 2
- Cannot upgrade opentelemetry until k8s.io/component-base upgrades HOT 1
- Multi-target ConstraintTemplate HOT 3
- Upgrade OPA to v0.40.0 HOT 4
- No longer know which resource is causing a violation HOT 1
- block template deployment if GK version is not compatible
- Result.Target is not populated
- update kubebuilder version to v3 HOT 1
- ci: make GH lint and make lint consistent HOT 1
- Consider tagging submodule "constraint"?
- Remove the notion of "Enforcement Action" from the engine interface HOT 2
- Use `fake` Driver in e2e tests
- Driver interface `AddConstraint` improvement
- Use OpenAPI default param values
- improving match criteria debuggability HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from frameworks.