Skip to content
Snippets Groups Projects

Added performance guidelines for new MRs

Merged yorickpeterse-staging requested to merge mr-performance-guides into master
All threads resolved!

What does this MR do?

This MR adds a set of guides that should be followed by merge request authors.

Are there points in the code the reviewer needs to double check?

Spelling, grammar, etc

Why was this MR needed?

There is no set of guidelines one should follow when submitting merge requests. This leads to developers at times disregarding performance. This in turn results in performance specialists having to clean up the mess, or production engineers being woken up in the middle of the night because the database is on fire.

Does this MR meet the acceptance criteria?

cc @DouweM @rspeicher @pcarranza @dzaporozhets

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Added 1 commit:

    • 02354d39 - Added performance guidelines for new MRs
  • @pcarranza @rspeicher The guide has been adjusted based on your feedback.

  • Added 1 commit:

    • e4e03d94 - Added performance guidelines for new MRs
  • yorickpeterse-staging Resolved all discussions

    Resolved all discussions

  • yorickpeterse-staging Marked the task All builds are passing as completed

    Marked the task All builds are passing as completed

  • Douwe Maan Milestone changed to %8.12

    Milestone changed to %8.12

  • @axil @pcarranza @rspeicher Any further feedback on these changes?

  • Nop, I'm good

  • @axil Any comments? Can this be merged?

  • Achilleas Pipinellis Status changed to merged

    Status changed to merged

  • mentioned in commit ee61c403

  • Yes! Thanks for pinging :)

  • Kamil Trzcińśki
    Kamil Trzcińśki @ayufan started a thread on commit e4e03d94
  • 61 ```ruby
    62 objects_to_update.each do |object|
    63 object.some_field = some_value
    64 object.save
    65 end
    66 ```
    67
    68 This will end up running one query for every object to update. This code can
    69 easily overload a database given enough rows to update or many instances of this
    70 code running in parallel. This particular problem is known as the
    71 ["N+1 query problem"](http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations).
    72
    73 In this particular case the workaround is fairly easy:
    74
    75 ```ruby
    76 objects_to_update.update_all(some_field: some_value)
    Please register or sign in to reply
    Loading