Discussion:
[fuse-devel] performance, bufsize and FUSE_MAX_PAGES_PER_REQ
Constantine Shulyupin
2017-06-18 17:36:32 UTC
Permalink
I noticed, when I've increased bufsize in libfuse and
FUSE_MAX_PAGES_PER_REQ in kernel I got better throughput.
To see the the difference you need to use fast target device, like
RAID or tmpfs.
Please see patches inline below.
I found that FUSE_MAX_PAGES_PER_REQ was set to 32, which is 128 KB for
4KB page many years ago:
334f485df (Miklos Szeredi 2005-09-09 13:10:27 -0700
31)#define FUSE_MAX_PAGES_PER_REQ 32

Questions:
Are there plans to alter FUSE_MAX_PAGES_PER_REQ?
I can add configuration of this parameter, what are requirements?

diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 5c4adc4..ffa29f0 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -25,7 +25,8 @@
#include <linux/kref.h>

/** Max number of pages that can be used in a single read request */
-#define FUSE_MAX_PAGES_PER_REQ 32
+//#define FUSE_MAX_PAGES_PER_REQ 32
+#define FUSE_MAX_PAGES_PER_REQ 256 // 256 * PAGE_SIZE = 1 M

/** Bias for fi->writectr, meaning new writepages must not be sent */
#define FUSE_NOWRITE INT_MIN

diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index a960123..3a1f191 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -2829,8 +2829,9 @@ struct fuse_session *fuse_session_new(struct
fuse_args *args,
if (se->debug)
fprintf(stderr, "FUSE library version: %s\n", PACKAGE_VERSION);

- se->bufsize = getpagesize() + 0x1000;
- se->bufsize = se->bufsize < MIN_BUFSIZE ? MIN_BUFSIZE : se->bufsize;
+ //se->bufsize = getpagesize() + 0x1000;
+ //se->bufsize = se->bufsize < MIN_BUFSIZE ? MIN_BUFSIZE : se->bufsize;
+ se->bufsize = (1<<20) + 0x1000;

list_init_req(&se->list);
list_init_req(&se->interrupts);
--
Constantine Shulyupin
http://www.MakeLinux.co.il/
Embedded Linux Systems
Tel Aviv
Nikolaus Rath
2017-07-09 13:22:25 UTC
Permalink
Hi,
Post by Constantine Shulyupin
I noticed, when I've increased bufsize in libfuse and
FUSE_MAX_PAGES_PER_REQ in kernel I got better throughput.
To see the the difference you need to use fast target device, like
RAID or tmpfs.
Please see patches inline below.
I found that FUSE_MAX_PAGES_PER_REQ was set to 32, which is 128 KB for
334f485df (Miklos Szeredi 2005-09-09 13:10:27 -0700
31)#define FUSE_MAX_PAGES_PER_REQ 32
Are there plans to alter FUSE_MAX_PAGES_PER_REQ?
Not that I'm aware of.
Post by Constantine Shulyupin
I can add configuration of this parameter, what are requirements?
This is really a kernel change - if it becomes configurable, libfuse
will adapt. Since you got no response here, I'd suggest to take it to
linux-kernel and linux-fsdevel.

I'm pretty sure one of the first things you'll be asked is to quantify
"better throughput", and to weigh it against the cost of setting it to a
higher value, and/or against the extra complexity from making it
configurable (how are users expected to determine what value to use?).


Best,
-Nikolaus
--
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

»Time flies like an arrow, fruit flies like a Banana.«
Loading...