Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

cs: improves the dru/init-user->dru-divisors performance … #742

Merged
merged 1 commit into from
Feb 28, 2018

Conversation

shamsimam
Copy link
Contributor

…by making fewer datomic queries from share/get-share

Changes proposed in this PR

  • introduce share/get-share-by-types which makes a single query to load shares for a user

Why are we making these changes?

For 250 users, reporting last time of 10 iterations and using in-memory db and 10K running tasks and 25K pending jobs

Before: Elapsed time: 366.445606 msecs (With a datomic connection backed by persistent storage this number is between 3 to 5 seconds)
After: Elapsed time: 163.840391 msecs

The 2-3X improvement is expected as it is making 2-3X fewer DB queries.

There are existing unit tests verifying this change in cook.test.mesos.share/test'.

@shamsimam shamsimam self-assigned this Feb 28, 2018
[?r :resource/amount ?a]]
datomic-resource-types (map resource-type->datomic-resource-type types)
default-type->share (pc/map-from-keys
(fn [type] (get type->share type Double/MAX_VALUE) )
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: extra space

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@shamsimam shamsimam force-pushed the optimize-init-user-dru-divisors branch from 81bb908 to 1893e6f Compare February 28, 2018 22:01
@dposada dposada merged commit 2444eb3 into master Feb 28, 2018
@dposada dposada deleted the optimize-init-user-dru-divisors branch February 28, 2018 22:27
dposada pushed a commit to dposada/Cook that referenced this pull request Nov 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants