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

[client.Client] Move autoreject logic to Go #188

Closed
willbeason opened this issue Jan 25, 2022 · 1 comment
Closed

[client.Client] Move autoreject logic to Go #188

willbeason opened this issue Jan 25, 2022 · 1 comment
Assignees

Comments

@willbeason
Copy link
Member

willbeason commented Jan 25, 2022

Prerequisites: #193 , #176

Per benchmarks in #186 , autorejection has a massive performance impact since (1) duplicating objects in Rego is expensive and (2)

Sample comparison. Each test indicates the result of every Constraint, so "autoreject" means all 1,000 Constraints autorejected the request.

BenchmarkClient_Review/1000_Constraints_100_Templates_success-12             	     122	  98551484 ns/op	26344853 B/op	  572764 allocs/op
BenchmarkClient_Review/1000_Constraints_100_Templates_fail-12                	      55	 201748681 ns/op	58626552 B/op	 1137203 allocs/op
BenchmarkClient_Review/1000_Constraints_100_Templates_filtered_out-12        	     415	  29254883 ns/op	 7601835 B/op	  179334 allocs/op
BenchmarkClient_Review/1000_Constraints_100_Templates_autoreject-12          	      31	 347175043 ns/op	115088467 B/op	 2127332 allocs/op

What's convenient for transitioning to a Go implementation of autorejection is that this means we can prevent all Constraints from running if even one autorejects. Autorejection means we are operating in an inconsistent state and will deny the object in the review request either way.

@willbeason willbeason added this to the Rego Environment Sharding milestone Jan 25, 2022
@willbeason willbeason self-assigned this Jan 25, 2022
@willbeason willbeason changed the title Move autoreject logic to Go [client.Client] Move autoreject logic to Go Feb 1, 2022
@willbeason
Copy link
Member Author

Autorejection should happen in the Client layer when it runs matching logic. This means we'll autoreject in Go before executing any Rego.

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

No branches or pull requests

1 participant