On Wed, Feb 10, 2010 at 9:49 AM, Nilesh Govindarajan <lists@xxxxxxxxxx> wrote: > Hi, > > Recently I'm facing a funny problem. pacman (and even packer) is toooo slow > to search -Ss (db+aur) or -Qs (db). I see a lot of HDD activity going on. > But when I run pacman-optimize, it gets fixed. > > This happens at every boot. Any ideas ? > > -- > Nilesh Govindarajan > Site & Server Adminstrator > www.itech7.com > Short: This happens because the pacman db isn't in the cache yet after a reboot, but after running pacman-optimize, the db is in the cache. Long: The cache is unused RAM used to store recent accessed files. When a file gets read from disk or written out to disk, it is also placed in the cache, and taken out when more memory is needed for new cache entries or applications need want more memory. Since the db is made up of a bunch of small files, this causes the hdd to have to move its arm around the disk. Linux file systems, unlike Windows, tries to reduce fragmentation by allocating space for each file evenly across the disk. The problem with this shows itself with pacman. The db files are scattered through the disk and the hdd has to seek (slow operation) to find all of them. So, once all these files are in cache, the hard drive doesn't need to be accessed to get the db. Memory is fast at random access (like the hard drive's seek operation). > I suggest you look this: > > http://bbs.archlinux.org/viewtopic.php?id=20385 > > It uses one single file to store all pacman's db tree, mounting it via > loop device, so it gets faster than the native filesystem. I use it > and the difference is impressive. > > HTH. Thus, with a single file, the Linux file system will try to store it as a contiguous block on the hard drive, and the hard drive won't have to seek around, greatly increasing throughput. -- Alexander Lam