patchNSS MySQL - Patches: patch #4942, Significant reduction of cpu load...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #4942: Significant reduction of cpu load when using +2000 in uid/gid lookups

Submitter:  None
Submitted:  Wed 01 Mar 2006 12:02:07 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Open

Wed 01 Mar 2006 12:04:43 PM UTC, comment #1: 

Forgot to mention that the patch also removes the 'order by uid/gid desc' clause from the lookups.  This was causing the query to get file sorted on disk which also caused a big slowdown.  It only seemed to appear in the most recent version of nss-mysql.

Anonymous
Wed 01 Mar 2006 12:02:07 PM UTC, original submission:  

We are using a query that looks a little like:
WHERE uid + 2000 = 40000
Unfortunately this causes MySQL to completely ignore the index and ends up using a complete table search...  If you don't believe try doing a simple explain on that query, and then:
WHERE uid = 38000
And you'll see the difference.

The purpose of this patch is to hard code the +2000 part of the query to remove it from the MySQL query.  This greatly increases speed as MySQL can then use the index.

Secondly, this patch causes a failed query if you look up a uid/gid lower than 2000 (all system ids for us).  These should fail for us anyway in the database, and should only ever be found in /etc/passwd.  This could probably be done in a better way (at the moment it just adds a WHERE 1=0 clause).  It then subtracts 2000 from the query id and runs the query like normal.  This should produce significant speed improvements if (like us) you have somewhere in excess of 100,000 users and groups.

This patch is only helpful if you currently specify '+ 2000' or similar in the config file.  After using this patch you'll need to remove the '+ 2000' from the configuration files.  Obviously if you add a different number then you'll need to alter the patch.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #9606:  nss-mysql-uid.patch added by None (5KiB - application/octet-stream - Patch file)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by
2006-03-01 None Attached File- Added nss-mysql-uid.patch, #6002

Back to the top

Powered by Savane 3.13-cf05.
Corresponding source code