Moodle

add cache to auth_ldap_sync_users.php

Details

  • Affected Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

I've attached a patch which I am using to speed up my LDAP sync. It speeds it up dramatically – initially used to take 9 hours and this patch cuts that down to 5 minutes!

The currently sync script does 1 big query for a list of usernames, then for each user it performs an additional lookup to get their attributes. On a large installation with 30k LDAP users and a bit of latency to the LDAP server, this was just taking far too long, so I modified the behaviour of the script to do just one query and ask for ALL the attributes that were required on each user, and then cache the results.

I am running this on just one particular installation so it would be great if other people could test and let me know if their sync still works and whether it is faster.

Thanks

Activity

Hide
Martin Dougiamas added a comment -

This sounds pretty good! +1 from me (but haven't reviewed code yet)

Show
Martin Dougiamas added a comment - This sounds pretty good! +1 from me (but haven't reviewed code yet)
Hide
Ashley Holman added a comment -

Here's a version of the patch against latest 20_STABLE: https://github.com/ashleyholman/moodle/tree/mdl-19382

Note the patch could be reworked to restructure the whole sync process instead of tacking on a cache, but I developed this from the perspective of it being a downstream patch that we were maintaining so it was made to be a minimal changeset

Would like to see this in core since it provides a really big speed boost for LDAP syncing..

Show
Ashley Holman added a comment - Here's a version of the patch against latest 20_STABLE: https://github.com/ashleyholman/moodle/tree/mdl-19382 Note the patch could be reworked to restructure the whole sync process instead of tacking on a cache, but I developed this from the perspective of it being a downstream patch that we were maintaining so it was made to be a minimal changeset Would like to see this in core since it provides a really big speed boost for LDAP syncing..
Hide
Michael Blake added a comment -

This issue has been reported to affect MP clients. Please give it priority.

Show
Michael Blake added a comment - This issue has been reported to affect MP clients. Please give it priority.

People

Vote (1)
Watch (4)

Dates

  • Created:
    Updated: