xfs
[Top] [All Lists]

Re: bad performance on touch/cp file on XFS system

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: bad performance on touch/cp file on XFS system
From: Zhang Qiang <zhangqiang.buaa@xxxxxxxxx>
Date: Mon, 25 Aug 2014 16:09:05 +0800
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=UKhvAvzDLCS+lsOkiux9JEwhIpnnzN43UieczOkOAi4=; b=WUyjqUAZbOi7d8A3rFTFdAnC82kC0Lv2mdO2wRtbUx/nXYWzwPV8rWUz45rschprt7 sqVRwkr9oRbdLaDlIEvNskFi2DnFiPUKDE3r4WBGbgDUWQZ1yXll4Rk3szDH+i4aJLOZ F3lz8bkA2JwEScRn2+5zegBUSz3lL5cGCh2WXeph1uLuTU0IhnT80wkDL94VDCqDX95C famb7LnPy8c2F2MRBQyLv7NAoYEFkAolIA5Nhb+tbXYXik2bwdYBBs/sEajOP46UBUR9 CrmIZUPlduav9HhCueXDN/pSILrvAE6gOI9j/7ifwkGdvMNiX6zgvx8fpeSs7VYgmqv/ /3hQ==
In-reply-to: <20140825051801.GY26465@dastard>
References: <CAKEtwsWxZseS8M+O7vSR2FRXr4gjVQ0RDO8ok+jMPWq-8jPEeA@xxxxxxxxxxxxxx> <20140825051801.GY26465@dastard>
Thanks for your quick and clear response. Some comments bellow:


2014-08-25 13:18 GMT+08:00 Dave Chinner <david@xxxxxxxxxxxxx>:
On Mon, Aug 25, 2014 at 11:34:34AM +0800, Zhang Qiang wrote:
> Dear XFS community & developers,
>
> I am using CentOS 6.3 and xfs as base file system and use RAID5 as hardware
> storage.
>
> Detail environment as follow:
>Â Â OS: CentOS 6.3
>Â Â Kernel: kernel-2.6.32-279.el6.x86_64
>Â Â XFS option info(df output): /dev/sdb1 on /data type xfs
> (rw,noatime,nodiratime,nobarrier)
>
> Detail phenomenon:
>
>Â Â Â# df
>  ÂFilesystem      Size Used Avail Use% Mounted on
>Â Â Â/dev/sda1Â Â Â Â Â Â Â 29GÂ Â17GÂ Â11GÂ 61% /
>Â Â Â/dev/sdb1Â Â Â Â Â Â Â893GÂ 803GÂ Â91GÂ 90% /data
>Â Â Â/dev/sda4Â Â Â Â Â Â Â2.2TÂ 1.6TÂ 564GÂ 75% /data1
>
>Â Â Â# time touch /data1/1111
>  Âreal  0m23.043s
>  Âuser  0m0.001s
>  Âsys  Â0m0.349s
>
>Â Â Â# perf top
>Â Â ÂEvents: 6K cycles
>Â Â Â 16.96%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] xfs_inobt_get_rec
>Â Â Â 11.95%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] xfs_btree_increment
>Â Â Â 11.16%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] xfs_btree_get_rec
>Â Â Â Â7.39%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] xfs_btree_get_block
>Â Â Â Â5.02%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] xfs_dialloc
>Â Â Â Â4.87%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] xfs_btree_rec_offset
>Â Â Â Â4.33%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] xfs_btree_readahead
>Â Â Â Â4.13%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] _xfs_buf_find
>Â Â Â Â4.05%Â [kernel]Â Â Â Â Â Â Â Â Â [k] intel_idle
>Â Â Â Â2.89%Â [xfs]Â Â Â Â Â Â Â Â Â Â Â[k] xfs_btree_rec_addr
>Â Â Â Â1.04%Â [kernel]Â Â Â Â Â Â Â Â Â [k] kmem_cache_free
>
>
> It seems that some xfs kernel function spend much time (xfs_inobt_get_rec,
> xfs_btree_increment, etc.)
>
> I found a bug in bugzilla [1], is that is the same issue like this?

No.
Â

> It's very greatly appreciated if you can give constructive suggestion about
> this issue, as It's really hard to reproduce from another system and it's
> not possible to do upgrade on that online machine.

You've got very few free inodes, widely distributed in the allocated
inode btree. The CPU time above is the btree search for the next
free inode.

This is the issue solved by this series of recent commits to add a
new on-disk free inode btree index:
[Qiang] This meas that if I want to fix this issue, I have to apply the following patches and build my own kernel.

As the on-disk structure has been changed, so should I also re-create xfs filesystem again? is there any user space tools to convert old disk filesystem to new one, and don't need to backup and restore currently data?

Â

53801fd xfs: enable the finobt feature on v5 superblocks
0c153c1 xfs: report finobt status in fs geometry
a3fa516 xfs: add finobt support to growfs
3efa4ff xfs: update the finobt on inode free
2b64ee5 xfs: refactor xfs_difree() inobt bits into xfs_difree_inobt() helper
6dd8638 xfs: use and update the finobt on inode allocation
0aa0a75 xfs: insert newly allocated inode chunks into the finobt
9d43b18 xfs: update inode allocation/free transaction reservations for finobt
aafc3c2 xfs: support the XFS_BTNUM_FINOBT free inode btree type
8e2c84d xfs: reserve v5 superblock read-only compat. feature bit for finobt
57bd3db xfs: refactor xfs_ialloc_btree.c to support multiple inobt numbers

Which is of no help to you, however, because it's not available in
any CentOS kernel.
[Qiang] Do you think if it's possible to just backport these patches to kernel Â6.2.32 (CentOS 6.3) to fix this issue?

Or it's better to backport to 3.10 kernel, used in CentOS 7.0?



There's really not much you can do to avoid the problem once you've
punched random freespace holes in the allocated inode btree. IT
generally doesn't affect many people; those that it does affect are
normally using XFS as an object store indexed by a hard link farm
(e.g. various backup programs do this).
OK, I see.

Could you please guide me to reproduce this issue easily? as I have tried to use a 500G xfs partition, and use about 98 % spaces, but still can't reproduce this issue. Is there any easy way from your mind?


If you dump the superblock via xfs_db, the difference between icount
and ifree will give you idea of how much "needle in a haystack"
searching is going on. You can probably narrow it down to a specific
AG by dumping the AGI headers and checking the same thing. filling
in all the holes (by creating a bunch of zero length files in the
appropriate AGs) might take some time, but it should make the
problem go away until you remove more filesystem and create random
free inode holes again...
Â
I will try to investigate the detail issue.

Thanks for your kindly response.
Qiang
Â

Cheers,

Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>