Bug 188052 - The useradd command slows as more users are added
Summary: The useradd command slows as more users are added
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: shadow-utils
Version: 4.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Peter Vrabec
QA Contact: Kevin Baker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-04-05 16:17 UTC by Heath Petty
Modified: 2014-12-01 23:08 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 16:01:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Heath Petty 2006-04-05 16:17:06 UTC
When adding large amounts of users to a system the useradd command slows

Description of problem: 
When using the following script the useradd command slows down. At around 11000
users the useradd command takes about 5 seconds, at around 23000 users is slows
to about 30 seconds:

#!/bin/bash

BEGIN=1
END=30000

ID=$BEGIN

while [ $ID -ge $BEGIN ] && [ $ID -le $END ]; do

        if [ $ID -le 9999 ]; then
                LOGIN=$(printf "%04d" "$ID")
        elif [ $ID -le 99999 ]; then
                LOGIN=$(printf "%05d" "$ID")
        fi

        /usr/sbin/useradd $LOGIN
#	I added the time command:
#	time /usr/sbin/useradd $LOGIN

        let ID=$ID+1

done

After running an strace on the useradd command it pauses at these two points:

lseek(9, 7052384, SEEK_SET)             = 7052384
write(9, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 292) = 292
close(9) 
.
.
.
sendto(3, "D\0\0\0T\4\5\0\1\0\0\0\0\0\0\0useradd: op=addi"..., 68, 0,
{sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 68
select(4, [3], NULL, NULL, {0, 100000}) = 1 (in [3], left {0, 100000})
recvfrom(3, "$\0\0\0\2\0\0\0\1\0\0\0E\20\0\0\0\0\0\0D\0\0\0T\4\5\0\1"..., 8476,
MSG_PEEK|MSG_DONTWAIT, {sa_family=AF_NETLINK, pid=0, groups=00000000}, [12])
= 36
recvfrom(3, "$\0\0\0\2\0\0\0\1\0\0\0E\20\0\0\0\0\0\0D\0\0\0T\4\5\0\1"..., 8476,
MSG_DONTWAIT, {sa_family=AF_NETLINK, pid=0, groups=00000000}, [12]) = 36


Version-Release number of selected component (if applicable):
RHEL 4 AS (both i386 and x86_64) running the 2.6.9-11, 2.6.9-22.0.1 and 2.6.9-34
smp kernels; shadow-utils-4.0.3-60.RHEL4. System is a 4 way Xeon EM64T 3.66Ghz
system with 6GB of RAM. 


How reproducible:

consistent results over several test runs


Steps to Reproduce:
1.Run the above script (to see times uncomment the time line)
2.
3.
  
Actual results:

The time to run useradd command increases as more users are added.

Expected results:

The time to run the useradd command should stay somewhat consistent.

Additional info:
Bug report from customer who is adding 100,000 users for a tftp server to serve
images to voip phones.

Comment 2 RHEL Program Management 2007-06-26 15:26:38 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 3 Steve Grubb 2007-07-31 22:31:47 UTC
My guess looking at the script is that they are flooding the audit system with
audit events. If they do not need the audit events from adding that many users,
they might try doing auditctl -e 0 and then run the test. At least that would
tell us if the audit system is overflowing - which puts the syscalls on a wait
queue. It might also be interesting to print out the audit backlog, auditctl -s
| awk '{ print $8 }'.

Comment 4 Steve Grubb 2007-08-01 12:22:01 UTC
We need to know if the audit system is causing the impact. If it is, that is an
expected condition. Thanks.

Comment 5 Peter Vrabec 2007-08-02 11:57:14 UTC
It's not caused by audit system. But I see some impact of nscd:

shadow-utils-4.0.3-60.RHEL4
---------------------------
# cat /etc/passwd | wc -l
30582
# service nscd status
nscd (pid 9423) is running...
# time useradd foo

real    0m34.011s
user    0m6.634s
sys     0m0.068s
# service nscd stop
Stopping nscd:                                             [  OK  ]
# time useradd foo1

real    0m8.030s
user    0m6.162s
sys     0m0.099s


Comment 6 RHEL Program Management 2007-09-07 19:45:22 UTC
This request was previously evaluated by Red Hat Product Management
for inclusion in the current Red Hat Enterprise Linux release, but
Red Hat was unable to resolve it in time.  This request will be
reviewed for a future Red Hat Enterprise Linux release.

Comment 8 Jiri Pallich 2012-06-20 16:01:57 UTC
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.


Note You need to log in before you can comment on or make changes to this bug.