I am running a postgres 8.4.5 server on the linux kernel on an 8 disk raid array with an LSI controller.

Most of the tables are around 1GB or less.

I know that XFS uses allocation groups (AG) to achieve I/O parallelism.

My first question is, does this mean that if two tables are in the same AG, all I/O requests are queued to both of them if either is being read from/written to?

If so, I assume I would want to spread my tables across as my allocation groups as possible, correct? Wouldn't this ensure that multiple users querying different tables would get the best performance?


What is the partition size in gigabytes? I usually divide that by 4 in order to determine the number of XFS allocation groups. I've run into situations where I only had one allocation group, and had problems with repair with an error indicating that there wasn't another AG to refer to in the file repair process. Either way, I think the general rule is partition size/4. There's some level of parallelism when running I/O against multiple allocation groups. But I'm assuming there's diminishing return on that number, so anywhere between partitionsize/2 and partitionsize/4 is reasonable.

So for a 200GB partition named "partitionname" on /dev/sdb1, I'd probably use the following mkfs.xfs command sequence.

mkfs.xfs -f -L /partitionname -d agcount=50 -l size=128m,version=2 /dev/sdb1

Also see: http://en.wikipedia.org/wiki/XFS#Allocation_groups

and http://everything2.com/index.pl?node_id=1479435 where it is noted:

At least one allocation group is needed per 4 gigs of space...
  • Thanks for the response. I have one 500GB partition and one 4TB partition. When you are saying the general rule is partition size/4 can I ask where you found this info? I have been googling all day and not been able to find anything this clear. – HBlend Jan 14 '11 at 1:19
  • See my edits above. – ewwhite Jan 14 '11 at 1:21
  • Thanks again for the follow up. I think the second reference may be outdated now though. The newer mkfs.xfs man pages (linux.die.net/man/8/mkfs.xfs) say an AG can go up to 1TB now unless I am misunderstanding something. – HBlend Jan 14 '11 at 1:31
  • I've been diving by four for 6 years or so in XFS deployments. It's a reasonable rule. If in doubt, test with different settings. But there are other places to tune your XFS mounts; noatime, nobarrier, log sizes, etc. – ewwhite Jan 14 '11 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.