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

Fix slow loading of policy revisions #326

Open
romangithub1024 opened this issue May 25, 2018 · 0 comments
Open

Fix slow loading of policy revisions #326

romangithub1024 opened this issue May 25, 2018 · 0 comments
Assignees
Labels

Comments

@romangithub1024
Copy link
Contributor

Steps to reproduce:

  1. Run ./tools/stress.sh, wait until it generates 500 policy revisions
  2. See that it start running a bit slow (takes a couple of seconds to process a change)
  3. Grab bolt.db, copy it over to /var/lib/aptomi/db.bolt.large, stop stress test
  4. Run stress again using /var/lib/aptomi/db.bolt.large as a starting point and generate tracing information
    DB=/var/lib/aptomi/db.bolt.large TRACE_PROFILE=aptomi.trace ./tools/stress.sh
  5. Run go tool trace aptomi.trace to see the issue

It spends 99% of the time here, performing N^2 operations:

github.com/Aptomi/aptomi/vendor/gopkg.in/yaml%2ev2.Unmarshal:84
github.com/Aptomi/aptomi/pkg/runtime/codec/yaml.(*yamlCodec).decodeOneOrMany:73
github.com/Aptomi/aptomi/pkg/runtime/codec/yaml.(*yamlCodec).DecodeOne:43
github.com/Aptomi/aptomi/pkg/runtime/store/generic/bolt.(*boltStore).List.func1:133
github.com/Aptomi/aptomi/vendor/github.com/boltdb/bolt.(*DB).View:629
github.com/Aptomi/aptomi/pkg/runtime/store/generic/bolt.(*boltStore).List:124
github.com/Aptomi/aptomi/pkg/runtime/store/generic/bolt.(*boltStore).ListGenerations:151
github.com/Aptomi/aptomi/pkg/runtime/store/core.(*defaultStore).GetFirstRevisionForPolicy:29
github.com/Aptomi/aptomi/pkg/api.(*coreAPI).handleRevisionGetByPolicy:37

We need to fix GetFirstRevisionForPolicy as well as GetAllRevisionsForPolicy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants