BigW Consortium Gitlab
Whenever you push to a branch GitLab will show a button to create a merge request (should one not exist already). The underlying code to display this data was quite inefficient. For example, it involved multiple slow queries just to figure out what the most recent push event was. This commit changes the way this data is retrieved so it's much faster. This is achieved by caching the ID of the last push event on every push, which is then retrieved when loading certain pages. Database queries are only executed if necessary and the cached data is removed automatically once a merge request has been created, or 2 hours after being stored. A trade-off of this approach is that we _only_ track the last event. Previously if you were to push to branch A and B then create a merge request for branch B we'd still show the widget for branch A. As of this commit this is no longer the case, instead we will only show the widget for the branch you pushed to most recently. Once a merge request exists the widget is no longer displayed. Alternative solutions are either too complex and/or too slow, hence the decision was made to settle for this trade-off. Performance Impact ------------------ In the best case scenario (= a user didn't push anything for more than 2 hours) we perform a single Redis GET per page. Should there be cached data we will run a single (and lightweight) SQL query to get the event data from the database. If a merge request already exists we will run an additional DEL to remove the cache key. The difference in response timings can vary a bit per project. On GitLab.com the 99th percentile of time spent in User#recent_push hovers between 100 milliseconds and 1 second, while the mean hovers around 50 milliseconds. With the changes in this MR the expected time spent in User#recent_push is expected to be reduced down to just a few milliseconds. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/35990
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
blob_viewer | Loading commit data... | |
ci | Loading commit data... | |
concerns | Loading commit data... | |
conversational_development_index | Loading commit data... | |
cycle_analytics | Loading commit data... | |
diff_viewer | Loading commit data... | |
hooks | Loading commit data... | |
issue | Loading commit data... | |
members | Loading commit data... | |
merge_request | Loading commit data... | |
network | Loading commit data... | |
project_services | Loading commit data... | |
protected_branch | Loading commit data... | |
ability_spec.rb | Loading commit data... | |
abuse_report_spec.rb | Loading commit data... | |
appearance_spec.rb | Loading commit data... | |
application_setting_spec.rb | Loading commit data... | |
award_emoji_spec.rb | Loading commit data... | |
blob_spec.rb | Loading commit data... | |
board_spec.rb | Loading commit data... | |
broadcast_message_spec.rb | Loading commit data... | |
chat_name_spec.rb | Loading commit data... | |
chat_team_spec.rb | Loading commit data... | |
commit_range_spec.rb | Loading commit data... | |
commit_spec.rb | Loading commit data... | |
commit_status_spec.rb | Loading commit data... | |
compare_spec.rb | Loading commit data... | |
container_repository_spec.rb | Loading commit data... | |
deploy_key_spec.rb | Loading commit data... | |
deploy_keys_project_spec.rb | Loading commit data... | |
deployment_spec.rb | Loading commit data... | |
diff_discussion_spec.rb | Loading commit data... | |
diff_note_spec.rb | Loading commit data... | |
discussion_spec.rb | Loading commit data... | |
email_spec.rb | Loading commit data... | |
environment_spec.rb | Loading commit data... | |
event_collection_spec.rb | Loading commit data... | |
event_spec.rb | Loading commit data... | |
external_issue_spec.rb | Loading commit data... | |
forked_project_link_spec.rb | Loading commit data... | |
generic_commit_status_spec.rb | Loading commit data... | |
global_milestone_spec.rb | Loading commit data... | |
gpg_key_spec.rb | Loading commit data... | |
gpg_signature_spec.rb | Loading commit data... | |
group_label_spec.rb | Loading commit data... | |
group_milestone_spec.rb | Loading commit data... | |
group_spec.rb | Loading commit data... | |
guest_spec.rb | Loading commit data... | |
identity_spec.rb | Loading commit data... | |
issue_collection_spec.rb | Loading commit data... | |
issue_spec.rb | Loading commit data... | |
key_spec.rb | Loading commit data... | |
label_link_spec.rb | Loading commit data... | |
label_priority_spec.rb | Loading commit data... | |
label_spec.rb | Loading commit data... | |
legacy_diff_discussion_spec.rb | Loading commit data... | |
lfs_objects_project_spec.rb | Loading commit data... | |
list_spec.rb | Loading commit data... | |
member_spec.rb | Loading commit data... | |
merge_request_diff_commit_spec.rb | Loading commit data... | |
merge_request_diff_file_spec.rb | Loading commit data... | |
merge_request_diff_spec.rb | Loading commit data... | |
merge_request_spec.rb | Loading commit data... | |
milestone_spec.rb | Loading commit data... | |
namespace_spec.rb | Loading commit data... | |
note_spec.rb | Loading commit data... | |
notification_setting_spec.rb | Loading commit data... | |
pages_domain_spec.rb | Loading commit data... | |
personal_access_token_spec.rb | Loading commit data... | |
project_authorization_spec.rb | Loading commit data... | |
project_auto_devops_spec.rb | Loading commit data... | |
project_feature_spec.rb | Loading commit data... | |
project_group_link_spec.rb | Loading commit data... | |
project_label_spec.rb | Loading commit data... | |
project_snippet_spec.rb | Loading commit data... | |
project_spec.rb | Loading commit data... | |
project_statistics_spec.rb | Loading commit data... | |
project_team_spec.rb | Loading commit data... | |
project_wiki_spec.rb | Loading commit data... | |
protectable_dropdown_spec.rb | Loading commit data... | |
protected_branch_spec.rb | Loading commit data... | |
protected_tag_spec.rb | Loading commit data... | |
push_event_payload_spec.rb | Loading commit data... | |
push_event_spec.rb | Loading commit data... | |
redirect_route_spec.rb | Loading commit data... | |
release_spec.rb | Loading commit data... | |
repository_spec.rb | Loading commit data... | |
route_spec.rb | Loading commit data... | |
sent_notification_spec.rb | Loading commit data... | |
service_spec.rb | Loading commit data... | |
snippet_blob_spec.rb | Loading commit data... | |
snippet_spec.rb | Loading commit data... | |
spam_log_spec.rb | Loading commit data... | |
subscription_spec.rb | Loading commit data... | |
system_note_metadata_spec.rb | Loading commit data... | |
timelog_spec.rb | Loading commit data... | |
todo_spec.rb | Loading commit data... | |
tree_spec.rb | Loading commit data... | |
trending_project_spec.rb | Loading commit data... | |
upload_spec.rb | Loading commit data... | |
user_agent_detail_spec.rb | Loading commit data... | |
user_spec.rb | Loading commit data... | |
wiki_directory_spec.rb | Loading commit data... | |
wiki_page_spec.rb | Loading commit data... |