-
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main() {
int fd = open("/jfs/testdata", O_RDWR);
if (fd < 0) {
printf("open file failed\n");
exit(1);
}
const char* data = "helloworld\n";
char buffer[1024];
for (int i = 0; i < 1000000; i++) {
int ret = read(fd, buffer, 1024);
if (ret < 0 ) {
printf("read file failed\n");
exit(1);
}
off_t off = lseek(fd, -1, SEEK_CUR);
int n = write(fd, data, strlen(data));
lseek(fd, n + off, SEEK_SET);
}
close(fd);
} 最近测试中发现的一个问题,我发现 geopandas 的 to_file 函数写到 juicefs 特别慢,strace 后发现是这样的调用模式,写了这个 s3里的object
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
There's a document about cache management: https://github.com/juicedata/juicefs/blob/main/docs/en/cache_management.md, please refer to it first. |
Beta Was this translation helpful? Give feedback.
-
@gaodq 在这种 读写混合的情况下,JuiceFS 确实性能还比较差,因为目前的数据读写路径是独立的,每次读都会把内存中的数据 flush,导致读很慢。这种情况下需要启用内核FUSE模块的 writeback 功能(-o writeback_cache),启用之后,上面的测试代码可以再 2 秒钟内完成,否则一直跑不完。 这个功能在商业版里已经支持,后续会给社区版也加上。 |
Beta Was this translation helpful? Give feedback.
@gaodq 在这种 读写混合的情况下,JuiceFS 确实性能还比较差,因为目前的数据读写路径是独立的,每次读都会把内存中的数据 flush,导致读很慢。这种情况下需要启用内核FUSE模块的 writeback 功能(-o writeback_cache),启用之后,上面的测试代码可以再 2 秒钟内完成,否则一直跑不完。
这个功能在商业版里已经支持,后续会给社区版也加上。