linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Very slow balance / btrfs-transaction
@ 2017-02-03 22:13 jb
  2017-02-03 23:25 ` Goldwyn Rodrigues
  2017-02-04  0:30 ` Jorg Bornschein
  0 siblings, 2 replies; 22+ messages in thread
From: jb @ 2017-02-03 22:13 UTC (permalink / raw)
  To: linux-btrfs

Hi, 


I'm currently running a balance (without any filters) on a 4 drives raid1 filesystem. The array contains 3 3TB drives and one 6TB drive; I'm running the rebalance because the 6TB drive recently replaced a 2TB drive. 


I know that balance is not supposed to be a fast operation, but this one is now running for ~6 days and it managed to balance ~18% (754 out of about 4250 chunks balanced (755 considered),  82% left) -- so I expect it to take another ~4 weeks. 

That seems excessively slow for ~8TiB of data.


Is this expected behavior? In case it's not: Is there anything I can do to help debug it?


The 4 individual devices are bcache devices with currently no ssd cache partition attached; the bcache backing devices sit ontop of luks encrypted devices. Maybe a few words about the history of this fs: It used to be a 1 drive btrfs ontop of a bcache partition with a 30GiB SSD cache (actively used for >1 year). During the last month, I gradually added devices (always with active bcaches). At some point, after adding the 4th device, I deactivated (detached) the bcache caching device and instead activated raid1 for data and metadata and ran a rebalance (which was reasonably fast -- I don't remember how fast exactly, but probably <24h). The finaly steps that lead to the current situation: I activated "nossd" and replaced the smallest device with "btrfs dev replace" (which was also reasonabley fast, <12h).

 

Best & thanks, 

   j


--
[joerg@dorsal ~]$ lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda               8:0    0 111.8G  0 disk
├─sda1            8:1    0     1G  0 part  /boot
└─sda2            8:2    0 110.8G  0 part
  └─crypted     254:0    0 110.8G  0 crypt
    ├─ssd-root  254:1    0  72.8G  0 lvm   /
    ├─ssd-swap  254:2    0     8G  0 lvm   [SWAP]
    └─ssd-cache 254:3    0    30G  0 lvm
sdb               8:16   0   2.7T  0 disk
└─sdb1            8:17   0   2.7T  0 part
  └─crypted-sdb 254:7    0   2.7T  0 crypt
    └─bcache2   253:2    0   2.7T  0 disk
sdc               8:32   0   2.7T  0 disk
└─sdc1            8:33   0   2.7T  0 part
  └─crypted-sdc 254:4    0   2.7T  0 crypt
    └─bcache1   253:1    0   2.7T  0 disk
sdd               8:48   0   2.7T  0 disk
└─sdd1            8:49   0   2.7T  0 part
  └─crypted-sdd 254:6    0   2.7T  0 crypt
    └─bcache0   253:0    0   2.7T  0 disk
sde               8:64   0   5.5T  0 disk
└─sde1            8:65   0   5.5T  0 part
  └─crypted-sde 254:5    0   5.5T  0 crypt
    └─bcache3   253:3    0   5.5T  0 disk  /storage
--

joerg@dorsal ~]$ sudo btrfs  fi usage -h /storage/
Overall:
    Device size:                  13.64TiB
    Device allocated:              8.35TiB
    Device unallocated:            5.29TiB
    Device missing:                  0.00B
    Used:                          8.34TiB
    Free (estimated):              2.65TiB      (min: 2.65TiB)
    Data ratio:                       2.00
    Metadata ratio:                   2.00
    Global reserve:              512.00MiB      (used: 15.77MiB)

Data,RAID1: Size:4.17TiB, Used:4.16TiB
   /dev/bcache0    2.38TiB
   /dev/bcache1    2.37TiB
   /dev/bcache2    2.38TiB
   /dev/bcache3    1.20TiB

Metadata,RAID1: Size:9.00GiB, Used:7.49GiB
   /dev/bcache1    8.00GiB
   /dev/bcache2    1.00GiB
   /dev/bcache3    9.00GiB

System,RAID1: Size:32.00MiB, Used:624.00KiB
   /dev/bcache1   32.00MiB
   /dev/bcache3   32.00MiB

Unallocated:
   /dev/bcache0  355.52GiB
   /dev/bcache1  356.49GiB
   /dev/bcache2  355.52GiB
   /dev/bcache3    4.25TiB
  
--
[joerg@dorsal ~]$ ps -xal | grep btrfs
1     0   227     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-worker]
1     0   229     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-worker-hi]
1     0   230     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-delalloc]
1     0   231     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-flush_del]
1     0   232     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-cache]
1     0   233     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-submit]
1     0   234     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-fixup]
1     0   235     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio]
1     0   236     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-met]
1     0   237     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-met]
1     0   238     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-rai]
1     0   239     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-rep]
1     0   240     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-rmw]
1     0   241     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-wri]
1     0   242     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-freespace]
1     0   243     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-delayed-m]
1     0   244     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-readahead]
1     0   245     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-qgroup-re]
1     0   246     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-extent-re]
1     0   247     2  20   0      0     0 -      S    ?          0:00 [btrfs-cleaner]
1     0   248     2  20   0      0     0 -      S    ?          0:30 [btrfs-transacti]
1     0  2283     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-worker]
1     0  2285     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-worker-hi]
1     0  2286     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-delalloc]
1     0  2287     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-flush_del]
1     0  2288     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-cache]
1     0  2289     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-submit]
1     0  2290     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-fixup]
1     0  2291     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio]
1     0  2292     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-met]
1     0  2293     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-met]
1     0  2294     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-rai]
1     0  2295     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-rep]
1     0  2296     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-rmw]
1     0  2297     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-endio-wri]
1     0  2298     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-freespace]
1     0  2299     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-delayed-m]
1     0  2300     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-readahead]
1     0  2301     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-qgroup-re]
1     0  2302     2   0 -20      0     0 -      S<   ?          0:00 [btrfs-extent-re]
1     0  2303     2  20   0      0     0 -      D    ?          0:10 [btrfs-cleaner]
1     0  2304     2  20   0      0     0 -      D    ?        3247:49 [btrfs-transacti]
4     0 10316  9321  20   0  83604  4868 -      S+   pts/1      0:00 sudo btrfs balance start /storage/
4     0 10317 10316  20   0  15788  1044 -      R+   pts/1    5352:22 btrfs balance start /storage/
0  1000 17901 13293  20   0  12288  2136 -      R+   pts/5      0:00 grep --color=auto btrfs

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: Very slow balance / btrfs-transaction
@ 2017-07-01 14:24 Sidney San Martín
  0 siblings, 0 replies; 22+ messages in thread
From: Sidney San Martín @ 2017-07-01 14:24 UTC (permalink / raw)
  To: rgoldwyn, linux-btrfs; +Cc: jb

February 3, 2017 11:26 PM, "Goldwyn Rodrigues" <rgoldwyn@suse.com> wrote:
> On 02/03/2017 04:13 PM, jb@capsec.org wrote:
> > Hi, 
> > 
> > 
> > I'm currently running a balance (without any filters) on a 4 drives raid1 
> > filesystem. The array contains 3 3TB drives and one 6TB drive; I'm running 
> > the rebalance because the 6TB drive recently replaced a 2TB drive. 
> > 
> > 
> > I know that balance is not supposed to be a fast operation, but this one is 
> > now running for ~6 days and it managed to balance ~18% (754 out of about 4250 
> > chunks balanced (755 considered),  82% left) -- so I expect it to take 
> > another ~4 weeks. 
> > 
> > That seems excessively slow for ~8TiB of data.
> > 
> > 
> > Is this expected behavior? In case it's not: Is there anything I can do to 
> > help debug it?
> 
> Do you have quotas enabled?
> 
> -- 
> Goldwyn

Just dropping in — I don’t normally follow the list but I found this thread when I was troubleshooting balance issues (kernel 4.11, converting raid1 to raid10). Disabling quotas had an immense impact on performance and it would be helpful if notes could be added in *lots* of places. With quotas on, each block group took 30 minutes to over an hour to convert, and the system was only usable for a few seconds per iteration:

    Jun 28 00:42:41 overkill kernel: BTRFS info (device sdc2): relocating block group 7141922439168 flags data|raid1
    Jun 28 01:32:13 overkill kernel: BTRFS info (device sdc2): relocating block group 7140848697344 flags data|raid1
    Jun 28 02:48:59 overkill kernel: BTRFS info (device sdc2): relocating block group 7139774955520 flags data|raid1
    Jun 28 03:50:12 overkill kernel: BTRFS info (device sdc2): relocating block group 7138701213696 flags data|raid1
    Jun 28 05:20:58 overkill kernel: BTRFS info (device sdc2): relocating block group 7137627471872 flags data|raid1
    Jun 28 06:49:00 overkill kernel: BTRFS info (device sdc2): relocating block group 7136553730048 flags data|raid1
    Jun 28 07:23:58 overkill kernel: BTRFS info (device sdc2): relocating block group 7135479988224 flags data|raid1
    Jun 28 08:03:39 overkill kernel: BTRFS info (device sdc2): relocating block group 7134406246400 flags data|raid1
    Jun 28 08:40:11 overkill kernel: BTRFS info (device sdc2): relocating block group 7133332504576 flags data|raid1
    Jun 28 09:44:46 overkill kernel: BTRFS info (device sdc2): relocating block group 7132258762752 flags data|raid1
    Jun 28 10:24:17 overkill kernel: BTRFS info (device sdc2): relocating block group 7131185020928 flags data|raid1
    Jun 28 11:35:39 overkill kernel: BTRFS info (device sdc2): relocating block group 7130111279104 flags data|raid1
    Jun 28 12:53:56 overkill kernel: BTRFS info (device sdc2): relocating block group 7129037537280 flags data|raid1
    Jun 28 13:37:00 overkill kernel: BTRFS info (device sdc2): relocating block group 7127963795456 flags data|raid1
    Jun 28 14:32:19 overkill kernel: BTRFS info (device sdc2): relocating block group 7126890053632 flags data|raid1
    Jun 28 15:45:19 overkill kernel: BTRFS info (device sdc2): relocating block group 7125816311808 flags data|raid1
    Jun 28 16:30:01 overkill kernel: BTRFS info (device sdc2): relocating block group 7124742569984 flags data|raid1
    Jun 28 17:26:57 overkill kernel: BTRFS info (device sdc2): relocating block group 7123668828160 flags data|raid1
    Jun 28 18:15:01 overkill kernel: BTRFS info (device sdc2): relocating block group 7122595086336 flags data|raid1
    Jun 28 18:48:05 overkill kernel: BTRFS info (device sdc2): relocating block group 7121521344512 flags data|raid1
    Jun 28 19:25:59 overkill kernel: BTRFS info (device sdc2): relocating block group 7120447602688 flags data|raid1
    Jun 28 19:55:46 overkill kernel: BTRFS info (device sdc2): relocating block group 7119373860864 flags data|raid1
    Jun 28 20:30:41 overkill kernel: BTRFS info (device sdc2): relocating block group 7118300119040 flags data|raid1
    Jun 28 21:28:43 overkill kernel: BTRFS info (device sdc2): relocating block group 7117226377216 flags data|raid1
    Jun 28 22:55:34 overkill kernel: BTRFS info (device sdc2): relocating block group 7114005151744 flags data|raid1
    Jun 28 23:19:06 overkill kernel: BTRFS info (device sdc2): relocating block group 7110783926272 flags data|raid1

With quotas off, it takes ~20 seconds to convert each block group and the system is completely usable:

    Jul 01 09:56:42 overkill kernel: BTRFS info (device sde): relocating block group 7085014122496 flags data|raid1
    Jul 01 09:56:59 overkill kernel: BTRFS info (device sde): relocating block group 7083940380672 flags data|raid1
    Jul 01 09:57:18 overkill kernel: BTRFS info (device sde): relocating block group 7082866638848 flags data|raid1
    Jul 01 09:57:39 overkill kernel: BTRFS info (device sde): relocating block group 7081792897024 flags data|raid1
    Jul 01 09:58:01 overkill kernel: BTRFS info (device sde): relocating block group 7080719155200 flags data|raid1
    Jul 01 09:58:27 overkill kernel: BTRFS info (device sde): relocating block group 7079645413376 flags data|raid1
    Jul 01 09:58:45 overkill kernel: BTRFS info (device sde): relocating block group 7078571671552 flags data|raid1
    Jul 01 09:59:00 overkill kernel: BTRFS info (device sde): relocating block group 7077497929728 flags data|raid1
    Jul 01 09:59:16 overkill kernel: BTRFS info (device sde): relocating block group 7076424187904 flags data|raid1

Cheers,
Sidney

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-07-01 14:24 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-03 22:13 Very slow balance / btrfs-transaction jb
2017-02-03 23:25 ` Goldwyn Rodrigues
2017-02-04  0:30 ` Jorg Bornschein
2017-02-04  1:07   ` Goldwyn Rodrigues
2017-02-04  1:47   ` Jorg Bornschein
2017-02-04  2:55     ` Lakshmipathi.G
2017-02-04  8:22       ` Duncan
2017-02-06  1:45     ` Qu Wenruo
2017-02-06 16:09       ` Goldwyn Rodrigues
2017-02-07  0:22         ` Qu Wenruo
2017-02-07 15:55           ` Filipe Manana
2017-02-08  0:39             ` Qu Wenruo
2017-02-08 13:56               ` Filipe Manana
2017-02-09  1:13                 ` Qu Wenruo
2017-02-06  9:14     ` Jorg Bornschein
2017-02-06  9:29       ` Qu Wenruo
2017-02-04 20:50   ` Jorg Bornschein
2017-02-04 21:10     ` Kai Krakow
2017-02-06 13:19       ` Austin S. Hemmelgarn
2017-02-07 19:47         ` Kai Krakow
2017-02-07 19:58           ` Austin S. Hemmelgarn
  -- strict thread matches above, loose matches on Subject: below --
2017-07-01 14:24 Sidney San Martín

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).