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

Concurent safe batch saver #15247

Merged
merged 8 commits into from
Jun 11, 2017
Merged

Conversation

Ladas
Copy link
Contributor

@Ladas Ladas commented May 30, 2017

Depends on:

Concurent batch safe saver strategy. Allowing us to do create&update in batched SQL queries, which will save a lot o time, using a remote db. (having 5ms network latency, we save ~1.5h on 1M of records being created/updated)

TBD:
A possbile candidate for replacing the INSERT ON CONFLICT UPDATE query is https://github.com/zdennis/activerecord-import/wiki/On-Duplicate-Key-Update

Also filled issue in Arel, since that would be the best to use:
rails/arel#485

@Ladas
Copy link
Contributor Author

Ladas commented May 30, 2017

@miq-bot assign @agrare

@Ladas
Copy link
Contributor Author

Ladas commented May 30, 2017

@miq-bot add_label enhancement

@miq-bot
Copy link
Member

miq-bot commented May 30, 2017

@Ladas 'enhancement' is an invalid assignee, ignoring...

@Ladas
Copy link
Contributor Author

Ladas commented May 30, 2017

@miq-bot add_label enhancement

Ladas added 8 commits May 31, 2017 17:09
Helper methods for building batch SQL create/update. For create
method, we also have a build_multi_selection_query that is able
to fetch the batch created objects, using their unique indexes.
Fix rubocop issue if -> next
Include SqlHelper module to a saver base class
Extract batch_size to a base class
Extract delete_record method to a base class
Use base class delete_record method
Use a base class methods in concurent_safe saver
Add concurrent_batch_safe saver
@Ladas Ladas force-pushed the concurent_batch_safe_saver branch from 1a268ed to 25840aa Compare May 31, 2017 15:09
@miq-bot
Copy link
Member

miq-bot commented May 31, 2017

Checked commits Ladas/manageiq@0e2a1f9~...25840aa with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
5 files checked, 0 offenses detected
Everything looks fine. 👍

@Ladas Ladas changed the title Concurent batch safe saver Concurent safe batch saver Jun 6, 2017
Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

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

This LGTM for now until we can implement it in arel

@agrare agrare merged commit d62dd7d into ManageIQ:master Jun 11, 2017
@agrare agrare added this to the Sprint 63 Ending Jun 19, 2017 milestone Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants