I probably need to point this module to an OU that has around 22,000 user accounts, most of which are in 3 child OUs.

Will this present any problems with this module?

CommentFileSizeAuthor
#5 l3.patch10.43 KBmiglius
#4 l2.patch10.45 KBmiglius

Comments

arnd’s picture

On my site with ldap_data module activated, every page request leads to at least two ldap queries, a login leads to 4. This is because several other modules call the user_load() core function, which finally calls _ldapdata_user_load().

I don't know, whether this could be improved inside ldap_data.

miglius’s picture

Assigned: Unassigned » miglius
Category: support » feature
Issue tags: +ldapdata

I think we need a static caching to reduce ldap queries.

aren cambre’s picture

Agreed. LDAP queries should only be needed the first time something is checked, not on every page load.

miglius’s picture

Status: Active » Needs review
StatusFileSize
new10.45 KB

The attached patch implements a static cache so only one ldap query should be fired out per every user load on the page load. Moreover, it has a configuration setting to cache, i.e, not query ldap to sync data for other users than the logged in user. This is useful for pages where multiple users are loaded and where each of those users were synced on the page load.

miglius’s picture

StatusFileSize
new10.43 KB

This patch has a bug fixed.

arnd’s picture

After login I now get 1 LDAP access per page.

I don't understand how I can test the synchronization option. What I did is: I changed the email address in MySQL. After login that is synchronized from LDAP. I changed it again and went to several pages, including my account and the LDAP data page, but nothing is synchronized, regardless whether I check Cache LDAP queries or not. Also I went to the user page as admin, but nothing was synchronized.

I will keep the patch and look for new issues. Thanks.

miglius’s picture

It used to be that on each user load, the ldap was queried and drupal profile was synced with the ldap data, which generated a lot of ldap traffic.

Now when cache is enabled, the synchronization will be done only for a currently logged in user. So if you change your ldap data and login to drupal, drupal profile should sync (pick a new ldap data), However, if you look at other users accounts as an admin, their data will not be synced until they themselves will log in.

aren cambre’s picture

Title: Does this handle massive ADs well? » LDAP traffic on every page view
Category: feature » bug

Modifying issue to make it more accurate. Once a user is signed in, there generally should be no more LDAP traffic for that user.

miglius’s picture

Not exactly. It will generate the traffic just for the user which is signed in. So if information in the LDAP is changed while the user is browsing the site, it will be immediately synced on the next page load. But the ldap information will not be synced for other users, which means if I am a user x and are looking at profile of user y, the y user's profile will not be synced until user y logs in to the site.

aren cambre’s picture

Title: LDAP traffic on every page view » Improving LDAP caching
Category: bug » feature

Thanks. I just talked with my AD system administrator, and turns out this is fine and not unusual.

I switched the title around to make this a more generic issue about caching than my specific problem.

miglius’s picture

Status: Needs review » Fixed

Committed.

miglius’s picture

Changed naming from caching to synchronization options and added additional option to sync data only on the login.

eriktoyra’s picture

Would this patch be possible to use with/port to the 5.x-1.3 version? I'm struggling with some serious performance issues because of this problem.

Status: Fixed » Closed (fixed)
Issue tags: -ldapdata

Automatically closed -- issue fixed for 2 weeks with no activity.