large teams cause project team page to render very slow (minute)
Created by: jdamick
- Summary: We have a team with about 250 users in it, if we add that team to a project and then try to view the project's team listing it render extremely slow. (~1 minute) which then can cause a backup in the handlers and temporary site outage if it's an impatient user that refreshes the page multiple times.
- Steps to reproduce: 1 Create a team with 250+ users 2 Assign them to a project. 3 Visit a the "Team" setting for a project with 250+ users in it.
- Expected behavior: Should take < 30s to render the page.
- Observed behavior:
see log below:
[2013-06-01 00:54:05] Started GET "/xxxx/team" for 50.112.141.42 at 2013-06-01 00:54:05 +0000
[2013-06-01 00:54:05] Processing by TeamMembersController#index as HTML
[2013-06-01 00:54:05] Parameters: {"project_id"=>"xxxxx"}
[2013-06-01 00:54:06] Rendered projects/_settings_nav.html.haml (5.4ms)
[2013-06-01 00:54:07] Rendered team_members/_assigned_team.html.haml (281.4ms)
[2013-06-01 00:54:07] Rendered team_members/_assigned_teams.html.haml (292.9ms)
[2013-06-01 00:54:07] Rendered team_members/_team_member.html.haml (282.5ms)
......... lots more .....
[2013-06-01 00:55:01] Rendered team_members/_team_member.html.haml (203.2ms)
[2013-06-01 00:55:01] Rendered team_members/_team_member.html.haml (202.7ms)
[2013-06-01 00:55:01] Rendered team_members/_team_member.html.haml (206.5ms)
[2013-06-01 00:55:01] Rendered team_members/_team_member.html.haml (206.9ms)
[2013-06-01 00:55:01] Rendered team_members/_team.html.haml (54479.2ms)
[2013-06-01 00:55:01] Rendered team_members/index.html.haml within layouts/project_resource (55247.0ms)
[2013-06-01 00:55:01] Rendered layouts/_head.html.haml (75.3ms)
[2013-06-01 00:55:01] Rendered layouts/_search.html.haml (192.0ms)
[2013-06-01 00:55:01] Rendered layouts/_head_panel.html.haml (205.4ms)
[2013-06-01 00:55:02] Rendered layouts/_init_auto_complete.html.haml (144.0ms)
[2013-06-01 00:55:02] Rendered layouts/_flash.html.haml (0.3ms)
[2013-06-01 00:55:02] Rendered shared/_no_ssh.html.haml (15.3ms)
[2013-06-01 00:55:04] Rendered layouts/nav/_project.html.haml (1716.0ms)
[2013-06-01 00:55:04] Completed 200 OK in 58872ms (Views: 57641.5ms | ActiveRecord: 443.2ms)
- Results of GitLab Application Check:
[_default] git@git-uswest2c01-01:~/gitlab$ bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...
Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.4.0 ? ... OK (1.4.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... yes
post-receive hooks in repos are links: ...
.......projects are ok, but names removed ......
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Checking Sidekiq ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... no
Try fixing it:
Redownload the init script
For more information see:
doc/install/installation.md in section "Install Init Script"
Please fix the error above and rerun the checks.
Projects have satellites? ...
.......projects are ok, but names removed ......
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... no
Try fixing it:
Update your git to a version >= 1.7.10 from 1.7.9
Please fix the error above and rerun the checks.
Checking GitLab ... Finished
- Version of GitLab you are running:
5-2-stable @ commit 02a7b1270bbe35a14b3c7701bcbcff39abc646da
- Possible fixes:
i've determined it's only very slow for projects projects where i'm not a master. In digging it appears that the Ability.project_abilities is being hit for every iteration render of the _team_member.html.haml.
- allow_admin = can? current_user, :admin_project, @project
Pull request referenced below.
Result from changes in pull request:
From:
[2013-06-01 00:55:01] Rendered team_members/_team_member.html.haml (206.9ms)
[2013-06-01 00:55:01] Rendered team_members/_team.html.haml (54479.2ms)
To:
[2013-06-02 02:40:36] Rendered team_members/_team_member.html.haml (2.1ms)
[2013-06-02 02:40:36] Rendered team_members/_team.html.haml (1412.6ms)