# User lookups very slow



## Steije (Jan 26, 2010)

Hi,

I have a FreeBSD 8.0-RELEASE-p2 machine running within a virtualised XenServer environment (using hardware virtualisation and local disk storage on the VM-host).

This machine is running a NIS-slave for user-sharing across several machines. In this particular case user lookups (like `id steije`) take forever.

If I run a `truss id steije` it keeps on reading the /etc/nsswitch.conf file over and over again (which I think is the problem here):


```
stat("/etc/nsswitch.conf",{ mode=-rw-r--r-- ,inode=44432,size=115,blksize=4096 }) = 0 (0x0)
stat("/etc/nsswitch.conf",{ mode=-rw-r--r-- ,inode=44432,size=115,blksize=4096 }) = 0 (0x0)
stat("/etc/nsswitch.conf",{ mode=-rw-r--r-- ,inode=44432,size=115,blksize=4096 }) = 0 (0x0)
stat("/etc/nsswitch.conf",{ mode=-rw-r--r-- ,inode=44432,size=115,blksize=4096 }) = 0 (0x0)
```

I've tried disabling NIS in /etc/nsswitch.conf, but even when I turn it off even running `id steije` stays slow. 

I have several other (8.0-p2) machines running in the same virtualised environment without having these kind of issues.

Is there anybody with a solution to this problem?


----------



## Steije (Jan 26, 2010)

(oh.. and by 'over and over again' I mean thousands of times)


----------



## SirDice (Jan 26, 2010)

Could you post your /etc/nsswitch.conf?


----------



## Steije (Jan 26, 2010)

Sure:

group: files
group_compat: nis
hosts: files dns
networks: files
passwd: files nis
passwd_compat: nis
shells: files


----------



## SirDice (Jan 26, 2010)

I know very little about NIS but have you tried nis first and files second on the passwd: line?

Also, did you have a look at 29.4 Network Information System (NIS/YP)?

It mentions some entries that need to be in /etc/passwd.


----------



## J65nko (Jan 26, 2010)

I have this discussion starred in my Gmail account:Long Format Directory Listing 15x Slower in FreeBSD 5.x Sounds similar


----------



## Steije (Jan 26, 2010)

SirDice: I've tried switching 'files' and 'nis' around, no impact however. I used the handbook to configure the whole NIS setup, there are two ways of configuring NIS (or enabling it), either adding a line to /etc/passwd or by using /etc/nsswitch.conf, I've used nsswitch.conf since 5.x.

J65nko: That's an interesting thread, removing the compat lines didn't make a difference here however.


----------



## Steije (Jan 31, 2010)

I've just compiled the system to 8-STABLE (with a XENHVM) kernel, the problem persists.. Any clues?


----------



## J65nko (Jan 31, 2010)

Post a message to the FreeBSD stable list and mention the thread I referred.


----------

