Modify

Opened 3 years ago

#9104 new defect

LdapPlugin performs > 2000 queries upon viewing a ticket

Reported by: nickrw Owned by: eblot
Priority: high Component: LdapPlugin
Severity: major Keywords: ldap queries slow view ticket
Cc: Trac Release: 0.11

Description

When browsing the wiki / other trac pages the LdapPlugin does roughly 7 LDAP lookups against my LDAP server. I have just recorded it performing 2,223 queries when loading a ticket page.

We have 64 users in LDAP, and 6 groups. Crunching some numbers from our LDAP logs it seems that there is a hit for each group name 171 times, and a hit for some users 12 times, and a hit for other users 6 times. There are 100 unique usernames being queried for (not sure where the additional users appear from, but they are all present in the 'assign to' box on the ticket page).

Due to the length of time it takes to perform the queries this results in excessive load times when viewing a ticket, sometimes upwards of 20 seconds.

My trac.ini [ldap] section looks like:

[ldap]
enable = true
basedn = dc=acme,dc=com
group_rdn = ou=group
groupmember = member
groupmemberisdn = true
groupname = groupofnames
host = ldap-read2.live.chonp.net
uidattr = cn
user_rdn = ou=People

My LDAP server logs look like: (user/group names changed)

Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=14 SRCH base="dc=acme,dc=com" scope=2 deref=0 filter="(objectClass=groupOfNames)"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=14 SRCH attr=dn
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=14 SEARCH RESULT tag=101 err=0 nentries=6 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=15 SRCH base="ou=people,dc=acme,dc=com" scope=2 deref=0 filter="(cn=joe.bloggs)"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=15 SRCH attr=dn
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=15 SEARCH RESULT tag=101 err=0 nentries=1 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=16 CMP dn="cn=acme-group1,ou=Group,dc=acme,dc=com" attr="member"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=16 RESULT tag=111 err=6 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=17 SRCH base="ou=people,dc=acme,dc=com" scope=2 deref=0 filter="(cn=joe.bloggs)"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=17 SRCH attr=dn
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=17 SEARCH RESULT tag=101 err=0 nentries=1 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=18 CMP dn="cn=acme-group2,ou=Group,dc=acme,dc=com" attr="member"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=18 RESULT tag=111 err=5 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=19 SRCH base="ou=people,dc=acme,dc=com" scope=2 deref=0 filter="(cn=joe.bloggs)"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=19 SRCH attr=dn
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=19 SEARCH RESULT tag=101 err=0 nentries=1 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=20 CMP dn="cn=acme-group3,ou=Group,dc=acme,dc=com" attr="member"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=20 RESULT tag=111 err=5 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=21 SRCH base="ou=people,dc=acme,dc=com" scope=2 deref=0 filter="(cn=joe.bloggs)"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=21 SRCH attr=dn
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=21 SEARCH RESULT tag=101 err=0 nentries=1 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=22 CMP dn="cn=acme-group4,ou=Group,dc=acme,dc=com" attr="member"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=22 RESULT tag=111 err=5 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=23 SRCH base="ou=people,dc=acme,dc=com" scope=2 deref=0 filter="(cn=joe.bloggs)"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=23 SRCH attr=dn
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=23 SEARCH RESULT tag=101 err=0 nentries=1 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=24 CMP dn="cn=acme-group5,ou=Group,dc=acme,dc=com" attr="member"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=24 RESULT tag=111 err=5 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=25 SRCH base="ou=people,dc=acme,dc=com" scope=2 deref=0 filter="(cn=joe.bloggs)"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=25 SRCH attr=dn
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=25 SEARCH RESULT tag=101 err=0 nentries=1 text=
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=26 CMP dn="cn=acme-group6,ou=Group,dc=acme,dc=com" attr="member"
Aug 18 18:08:17 util2 slapd[27174]: conn=124 op=26 RESULT tag=111 err=5 text=

Attachments (0)

Change History (0)

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.