1

I am running a PostgreSQL 8.4.5 server on the linux 2.6.33.7 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 many allocation groups as possible, correct? Wouldn't this ensure that multiple users querying different tables would get the best performance?

HBlend
  • 145
  • 1
  • 3
  • From the [XFS FAQ: I want to tune my XFS filesystems for *something*](http://xfs.org/index.php/XFS_FAQ#Q:_I_want_to_tune_my_XFS_filesystems_for_.3Csomething.3E): "The standard answer you will get to this question is this: use the defaults". – Cristian Ciupitu Aug 08 '14 at 22:00

1 Answers1

2

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...
Cristian Ciupitu
  • 6,226
  • 2
  • 41
  • 55
ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • 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 01:19
  • See my edits above. – ewwhite Jan 14 '11 at 01:21
  • Thanks again for the follow up. I think the second reference may be outdated now though. The newer mkfs.xfs man pages (http://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 01: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 01:35