-
Notifications
You must be signed in to change notification settings - Fork 102
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
list index performance update for wwsympa.fcgi do_lists subroutine #925
list index performance update for wwsympa.fcgi do_lists subroutine #925
Conversation
…ntries instead of database lookups for list membership.
0412137
to
24f9298
Compare
src/cgi/wwsympa.fcgi.in
Outdated
foreach my $list (values %{$which->{'owner'}}) { | ||
$which->{'privileged_owner'}->{$list->{'name'}} = | ||
$list->is_admin('privileged_owner', $param->{'user'}{'email'}); | ||
$which->{'actual_editor'}->{$list->{'name'}} = | ||
$list->is_admin('actual_editor', $param->{'user'}{'email'}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think actual_editor is not always the owner.
…e between priv owner and owner from get_which lookup.
Thanks for the review Soji and apologies for the misplacement there.
The update addresses this issue to get the actual_editor info and also properly differentiates between a privileged owner and normal owner. |
c8ea25b
to
bfbe662
Compare
This is part of Sympa::List::get_admin(): Lines 2983 to 3022 in db8702f
Therefore, the user belongs to |
Thanks for the additional info Soji. In terms of the applications functionality, it makes sense that if a list has no 'moderator', then the lists 'owners' inherit that role. The PR should take the 'actual_editor' in to consideration as the current code does. The current code sets the editor to 1 when calling the is_admin('actual_editor') method on the list object: Lines 4249 to 4254 in 7433eb4
Then to establish the 'actual_editor' in the PR:
We're still using the is_admin('actual_editor') method to determine whether or not the list for the user should have the editor set to 1 or not. Does this update track with the current code implementation? Apologies if I am misunderstanding this! |
I think you are right. To keep compatibility to current behavior, we'd be better to use |
Okay, thanks for the additional info Soji. Please do let me know if you see any other areas of concern here from this update. I appreciate your insight! |
@olivov, I don't have any more questions! |
Hello, I started a thread on sympa-users ML regarding wwsympa performances. My findings are based on code profiling. One of the issue I identified is close to your findings: too many database requests to build the list of lists. However I'd be in favor of a more global approach, not solving the problem on the wwsympa side only. Actually you'd have the same performance issues in other processes that need to find out which lists a user is owner/editor/member of. I'd suggest making changes in Sympa/List.pm:
This change would really bring better performances and would benefit all Sympa interfaces (CLI, web, mail, SOAP). |
@salaum-urennes1, Additionally, “The cache caused tons of problems”, and it should be removed. See pinned issue “Sympa caching” and related issues (I don’t show hash-number so that this pr won’t be related to it). |
I feel the approach this PR makes is nice. I'll add a few fixes and merge it. |
I tried the PR code in our staging environment with 2384 mailing lists, with NYTProfiler enabled. Once Sympa::List::get_lists() has been executed, do_prepare_query() should not be called 2393 times by Sympa::List::get_current_admins(). Also 4619 calls to do_prepare_query() from Sympa::List::has_included_users probably costs a lot. |
@salaun-urennes1, please submit a new issue precisely describing your approach. |
…olivov & ikedas list index performance update for wwsympa.fcgi do_lists subroutine (#925)
For some background information, we're running Sympa 6.2.54 in a
RHEL 7 environment. We've got around 6,000 lists and close to
770,000 subscribers.
Since upgrading to Sympa 6.2 about two years ago, we've come across
a performance issue when an authenticated user uses the "list index"
page (the /sympa/lists URI) to view all lists they have access to
see. This page can take quite a while to load for an authenticated
user (30-45 seconds).
Digging around in the code, it appears the reason it takes a long
time for this page to load in our environment is that there is a
database lookup on a per list basis to check whether or not the user
is either a privileged owner, owner, editor or subscriber. This
lookup has become expensive for us due to the large number of active
lists we have in our environment.
With this update, we've made some changes to the do_lists subroutine
in wwsympa.fcgi. A hash is loaded with the user's list membership
and we use hash lookups to check for user's list membership to avoid
a large number of database lookups. We hope this change does not
obviate any list visibility checking mechanisms for which we have
not thought of but we've tried to leverage the existing list loop
checking mechanism to avoid any unwanted visibility issues. This
update has been vetted for Sympa 6.2.54 and we've seen a 3x
performance improvement in our environment with load times (albeit
long still) between 10-15 seconds.