{"id":2613,"date":"2019-10-21T06:44:38","date_gmt":"2019-10-20T21:44:38","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=2613"},"modified":"2019-10-21T06:44:38","modified_gmt":"2019-10-20T21:44:38","slug":"btrfss-btrfs-transaction-causes-io-to-become-100","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2019\/10\/21\/btrfss-btrfs-transaction-causes-io-to-become-100\/","title":{"rendered":"Btrfs\u306ebtrfs-transaction\u3067io\u304c100%\u306b\u306a\u3063\u3066\u56f0\u308b"},"content":{"rendered":"<div class=\"paragraph\">\n<p>\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u691c\u7d22\u306eRecoll\u3092\u8a66\u3057\u3066\u307f\u3088\u3046\u3068 <code>recollindex<\/code> \u30b3\u30de\u30f3\u30c9\u3067index\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\uff0e\u3059\u308b\u3068\u69d8\u3005\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u30d5\u30ea\u30fc\u30ba\uff0eindex\u304c\u51fa\u6765\u308b\u307e\u3067\u306e\u8f9b\u62b1\u3060\u308d\u3046\u30681\u65e5\u307b\u3069\u653e\u7f6e\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u89e3\u6d88\u3057\u307e\u305b\u3093\uff0e<br \/>\n1\u3064\u306e\u30b3\u30de\u30f3\u30c9\u3092\u767a\u884c\u3057\u3066\u5b9f\u884c\u3055\u308c\u308b\u307e\u3067\u4f55\u5206\u3082\u639b\u304b\u3063\u3066\u3057\u307e\u3044\u307e\u3059\uff0e<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>cpu\u3084memory\u306f\u30ac\u30e9\u30ac\u30e9\u3067\u3059\uff0e<br \/>\n<code>iotop<\/code> \u3092\u53e9\u3044\u3066\u307f\u308b\u3068 <code>btrfs-transaction<\/code> \u304c\u307b\u307c100%\u3067\u5f35\u308a\u4ed8\u3044\u3066\u3044\u307e\u3059\uff0e<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>\u30de\u30a6\u30f3\u30c8\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u3053\u3093\u306a\u611f\u3058\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>$ mount | grep \\ \/\\\n\/dev\/mapper\/t430s--vg-root on \/ type btrfs (rw,noatime,nodiratime,ssd,discard,space_cache,subvolid=5,subvol=\/)<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p><code>discard<\/code> \u3092 `btrfs(5) ` \u3067\u78ba\u8a8d\u3059\u308b\u3068\u3061\u3087\u3063\u3068\u602a\u3057\u3044\u3088\u3046\u306a?<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>       discard, nodiscard\n           (default: off)\n\n           Enable discarding of freed file blocks. This is useful for SSD devices, thinly provisioned LUNs, or virtual machine images; however, every storage layer must\n           support discard for it to work. if the backing device does not support asynchronous queued TRIM, then this operation can severely degrade performance, because a\n           synchronous TRIM operation will be attempted instead. Queued TRIM requires newer than SATA revision 3.1 chipsets and devices.\n\n       If it is not necessary to immediately discard freed blocks, then the fstrim tool can be used to discard all free blocks in a batch. Scheduling a TRIM during a period\n       of low system activity will prevent latent interference with the performance of other operations. Also, a device may ignore the TRIM command if the range is too\n       small, so running a batch discard has a greater probability of actually discarding the blocks.\n\n       If discarding is not necessary to be done at the block freeing time, there\u2019s fstrim(8) tool that lets the filesystem discard all free blocks in a batch, possibly not\n       much interfering with other operations. Also, the device may ignore the TRIM command if the range is too small, so running the batch discard can actually discard the\n       blocks.<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>SATA\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3059\u308b\u3068 <code>3.2<\/code> \u306a\u306e\u3067\u554f\u984c\u7121\u3055\u305d\u3046?<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight\"><code>$ sudo smartctl --info \/dev\/sda | grep ^SATA\nSATA Version is:  SATA 3.2, 6.0 Gb\/s (current: 6.0 Gb\/s)<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u3067\u3082\u4e00\u65e6\u7121\u52b9\u306b\u3057\u3066\u307f\u307e\u3059\uff0e<br \/>\n\uff03\u3064\u3044\u3067\u306b\u4ed8\u3051\u305f <code>compress=lzo<\/code> \u306f\u5225\u3067\u3084\u308b\u3079\u304d\u3060\u3063\u305f\u2026\u2026\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>$ time sudo mount -o remount,rw,noatime,nodiratime,ssd,nodiscard,compress=lzo,space_cache \/\nreal    42m32.840s\nuser    0m0.014s\nsys     0m15.209s\n$ mount | grep \\ \/\\\n\/dev\/mapper\/t430s--vg-root on \/ type btrfs (rw,noatime,nodiratime,compress=lzo,ssd,space_cache,subvolid=5,subvol=\/)<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u3053\u308c\u304c\u5f53\u305f\u308a\u3060\u3063\u305f\u3088\u3046\u3067io\u306f\u4e00\u6c17\u306b\u7a7a\u304d\u307e\u3057\u305f!<br \/>\nSATA 3.2 \u3060\u3051\u3069\u4f55\u304b\u5225\u306e\u6761\u4ef6\u304c\u826f\u304f\u306a\u3044\u306e\u3067\u3057\u3087\u3046\u304b?<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>\u5fd8\u308c\u306a\u3044\u3046\u3061\u306b <code>fstab<\/code> \u3082\u4fee\u6b63\u3057\u3066\u304a\u304d\u307e\u3059\uff0e(<code>nodiscard<\/code> \u306f\u65e2\u5b9a\u5024\u306a\u306e\u3067\u66f8\u3044\u3066\u3044\u306a\u3044)<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre> sudo git -C \/etc diff HEAD^ -- \/etc\/fstab\ndiff --git a\/fstab b\/fstab\nindex b029749..386278f 100644\n--- a\/fstab\n+++ b\/fstab\n@@ -5,7 +5,7 @@\n # that works even if disks are added and removed. See fstab(5).\n #\n # &lt;file system&gt; &lt;mount point&gt;   &lt;type&gt;  &lt;options&gt;       &lt;dump&gt;  &lt;pass&gt;\n-\/dev\/mapper\/t430s--vg-root \/               btrfs   noatime,nodiratime,ssd,discard,space_cache 0       0\n+\/dev\/mapper\/t430s--vg-root \/               btrfs   noatime,nodiratime,ssd,compress=lzo,space_cache 0       0\n # \/boot was on \/dev\/sda2 during installation\n UUID=cba2591a-12da-481e-b239-c002faca22e1 \/boot           ext2    defaults        0       2\n # \/boot\/efi was on \/dev\/sda1 during installation<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u3053\u308c\u3067\u66ab\u304f\u69d8\u5b50\u3092\u898b\u3066\u307f\u307e\u3059\uff0e<br \/>\n\u554f\u984c\u306a\u3051\u308c\u3070\u5225\u9014TRIM\u3092\u8a2d\u5b9a\u3057\u305f\u307b\u3046\u304c\u3044\u3044\u304b\u306a?<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>\u74b0\u5883<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>$ dpkg-query -W btrfs-progs iotop smartmontools\nbtrfs-progs     5.2.1-1\niotop   0.6-24-g733f3f8-1\nsmartmontools   7.0-2\n$ sudo smartctl -i \/dev\/sda | grep -E '^Device Model:|Firmware Version:|SATA Version is:'\nDevice Model:     Seagate BarraCuda SSD ZA1000CM10002\nFirmware Version: STAS1024\nSATA Version is:  SATA 3.2, 6.0 Gb\/s (current: 6.0 Gb\/s)\n$ lsb_release -dr\nDescription:    Debian GNU\/Linux bullseye\/sid\nRelease:        unstable\n$ uname -m\nx86_64<\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u691c\u7d22\u306eRecoll\u3092\u8a66\u3057\u3066\u307f\u3088\u3046\u3068 recollindex \u30b3\u30de\u30f3\u30c9\u3067index\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\uff0e\u3059\u308b\u3068\u69d8\u3005\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u30d5\u30ea\u30fc\u30ba\uff0eindex\u304c\u51fa\u6765\u308b\u307e\u3067\u306e\u8f9b\u62b1\u3060\u308d\u3046\u30681\u65e5\u307b\u3069\u653e\u7f6e\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u89e3\u6d88\u3057\u307e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[7,6,199,1],"tags":[163],"class_list":["post-2613","post","type-post","status-publish","format-standard","hentry","category-debian-linux","category-linux","category-sid","category-1","tag-btrfs"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/comments?post=2613"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2613\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=2613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=2613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=2613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}