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

Batch report calls in hash_redis_store #331

Merged
merged 3 commits into from
Oct 7, 2019
Merged

Conversation

kbaum
Copy link
Collaborator

@kbaum kbaum commented Oct 6, 2019

Little bump up in cpu but much faster:

Before:

image

➜  coverband git:(change_to_hash) COVERBAND_HASH_REDIS_STORE=t bundle exec rake benchmarks:redis_reporting
/Users/karlbaum/workspace/coverband/lib/coverband.rb:35: warning: already initialized constant Coverband::Adapters::RedisStore
/Users/karlbaum/workspace/coverband/lib/coverband/adapters/redis_store.rb:8: warning: previous definition of RedisStore was here
D, [2019-10-06T17:51:00.626595 #70722] DEBUG -- : using default configuration
runs benchmarks on reporting large sets of files to redis
Warming up --------------------------------------
   store_reports_all     1.000  i/100ms
Calculating -------------------------------------
   store_reports_all      2.029  (± 0.0%) i/s -     31.000  in  15.384839s
Warming up --------------------------------------
store_reports_subset     5.000  i/100ms
Calculating -------------------------------------
store_reports_subset     58.196  (± 8.6%) i/s -      1.155k in  20.025083s

After:

i mage

➜  coverband git:(batch_call_lua) COVERBAND_HASH_REDIS_STORE=t bundle exec rake benchmarks:redis_reporting
runs benchmarks on reporting large sets of files to redis
Warming up --------------------------------------
   store_reports_all     1.000  i/100ms
Calculating -------------------------------------
   store_reports_all      4.660  (± 0.0%) i/s -     70.000  in  15.066954s
Warming up --------------------------------------
store_reports_subset    13.000  i/100ms
Calculating -------------------------------------
store_reports_subset    131.136  (± 6.9%) i/s -      2.613k in  20.049154s

Looks to be about 2X as fast according to our performance benchmark task.

@kbaum kbaum changed the base branch from master to change_to_hash October 6, 2019 21:53
updated_time: updated_time
)
end.to_json
arguments_key = [@redis_namespace, SecureRandom.uuid].compact.join('.')
Copy link
Owner

Choose a reason for hiding this comment

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

do these other steps need to be wrapped in if keys.any?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. I don't see the harm in it and it might save us unnecessary hits to redis. Good thing is we do have a test for it so think its currently functional.

https://github.com/danmayer/coverband/blob/master/test/coverband/adapters/hash_redis_store_test.rb#L31

Copy link
Owner

@danmayer danmayer left a comment

Choose a reason for hiding this comment

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

added one comment but looks good

@kbaum
Copy link
Collaborator Author

kbaum commented Oct 7, 2019

@danmayer - to be clear, the cpu usage on redis still goes down about 20-25% compared to master for our benchmarks. I was comparing this iteration with the change_to_hash branch.

@kbaum kbaum merged commit 053a5e1 into change_to_hash Oct 7, 2019
@kbaum kbaum deleted the batch_call_lua branch October 7, 2019 18:55
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

Successfully merging this pull request may close these issues.

None yet

2 participants