More Related Content Similar to Using Alluxio POSIX (FUSE) API in JD.com (20) More from Alluxio, Inc. (20) Using Alluxio POSIX (FUSE) API in JD.com2. 1 2
3 4
Alluxio FUSE在京东的应用 解读Alluxio FUSE原理和架构
Alluxio FUSE的POSIX兼容性 京东在Alluxio社区的贡献
目录
5. Alluxio FUSE在京东的应用 – 早期海量文件共享服务
5
劣势
费时
数据从HDFS推送至
Cephfs,约增加一倍耗时
费力
需要数据一致性校
验,耗费大量时间
难度大Ceph集群不易运维,新
手难以掌握
稳定性
内核ceph模块增加
操作系统不稳定性
一写多读
6. Alluxio FUSE在京东的应用 – 海量文件高速共享服务
6
缺点
• Alluxio FUSE宜采用Direct_IO,无Page Cache加速
• FUSE受限于架构设计,性能不及内核态fs
• Alluxio的稳定性将影响BDP SLA
A
Hadoop Client集成Alluxio
Client,应用编程无感知,只需
替换Schema
B
数据经过Alluxio同步地写穿到
HDFS,耗时只是略微增加,省去
推送环节,较早期模型约缩短一
倍时间
C 不影响操作系统稳定性
D
同样使用Native fs,文件消
费者无感知
9. 解读Alluxio FUSE原理和架构 - 核心架构
FUSE: Filesystem in Userspace(用户空间文件系统)
AlluxioFuseFileSystem extends FuseStubFS {
+ int create(String path, long mode, FuseFileInfo fi)
+ int open(String path, FuseFileInfo fi)
+ int chmod(String path, long mode)
+ int chown(String path, long uid, long gid)
+ int mkdir(String path, long mode)
+ int readdir(String path, Pointer buff, FuseFillDir filter, long offset,
FuseFileInfo fi)
......
}
1
2
3
4
5
6
AlluxioFuse
jnr-fuse
libfuse
vfs
Alluxio基于jnr-fuse
实现用户态文件系统
的守护进程
fuse 的用户态库
An FUSE implementation
in java using Java Native
Runtime
Virtual File System,
虚拟文件系统
/dev/fuse
fuse模块创建的字符设
备,是内核与libfuse
交互的通道,所有挂载
点(Mount Point)共享
kernel fuse
基于vfs实现的内核模块
10. 解读Alluxio FUSE原理和架构 - 使用方法
安装依赖
# yum install -y fuse-libs fuse
配置
# cat alluxio-2.0.0/conf/alluxio-site.properties
alluxio.master.hostname=x.x.x.x
# echo user_allow_other >> /etc/fuse.conf
挂载Alluxio FUSE
# ./alluxio-2.0.0/integration/fuse/bin/alluxio-fuse mount -o <options> /mountpoint /path/in/alluxio
查看Alluxio FUSE挂载点
# ./alluxio-2.0.0/integration/fuse/bin/alluxio-fuse stat
pid mount_point alluxio_path
130741 /mountpoint /path/in/alluxio
查看挂载参数
# mount -t fuse.alluxio-fuse
alluxio-fuse on /mountpoint type fuse.alluxio-fuse
(rw,nosuid,nodev,relatime,user_id=1001,group_id=1001,allow_other)
查看存储空间
# df -h -t fuse.alluxio-fuse
Filesystem Size Used Avail Use% Mounted on
alluxio-fuse 211T 53G 211T 1% /mountpoint
卸载Alluxio FUSE
# ./alluxio-2.0.0/integration/fuse/bin/alluxio-fuse umount /mountpoint
或 # umount /mountpoint
11. 解读Alluxio FUSE原理和架构 - 初始化流程
1. jnr-fuse将AlluxioFuseFileSystem打
包传给libfuse
2. libfuse打开/dev/fuse字符设备,返回
文件描述符fd(File Descriptor)。fd在
进程内的线程间共享,因此fuse很容
易支持multi-thread模式;fd在进程
间不共享,且file支持私有数据,因此
fuse支持多种类型的挂载点
3. mount系统调用传参fd,libfuse和
kernel fuse通过fd这个桥梁建立虚拟
连接
4. super_block和file的私有数据对应虚拟连接
5. multi-thread模式下,多个线程同时从/dev/fuse读取请求
6. 当前无请求时,read系统调用阻塞
7. 当请求到来时,唤醒被阻塞的线程,read返回文件系统请求
14. Alluxio FUSE的POSIX兼容性 - 兼容性测试
14
fstest - 简化版的文件系统POSIX兼容性测试套件
https://www.tuxera.com/community/posix-test-suite/
使用方法
wget http://download.tuxera.com/sw/qa/pjd-fstest-20080816.tgz
tar xf pjd-fstest-20080816.tgz
cd pjd-fstest-20080816
make
(切记,进入待测试目录!!!)
cd /your/test/dir
整体测试
prove -r pjd-fstest-20080816/tests
单独测试
prove pjd-fstest-20080816/tests/unlink/00.t
定位失败测试
# strace -T -f -r prove pjd-fstest-20080816/tests/mkfifo/00.t > /tmp/ mkfifo.log 2>&1
[pid 54451] mknod("fstest_34c2d9dbec1aed322d9ffc452ce32469", S_IFIFO|0644 <unfinished ...>
[pid 54451] <... mknod resumed> ) = -1 ENOSYS (Function not implemented) <0.000814>
01
03
02
04
05
06
ext4
极少数失败
kernel ceph
极少数失败
Alluxio-fuse
部分失败
xfs
极少数失败
ceph-fuse
少数失败
hdfs-fuse
大部分失败
15. Alluxio FUSE的POSIX兼容性 - 兼容性
15
兼容列表
create, rename, open, unlink
getattr, chmod, chown
mkdir, readdir ,rmdir
read, write, flush
dup2
……
不兼容列表
不支持在创建文件或目录时指定权限<已解决>
不支持修改文件属主或属组为当前不存在的用户或组
不支持软连接
未检查文件名长度是否超出255 <已解决>
不支持mkfifo, mknod
不支持truncate
不支持扩展属性
不支持fallocate
不支持utimes
不支持append
......
User & Group
POSIX定义的文件元数据中记录User & Group ID
如果系统中不存在该ID对应的User或Group:
# chown 12345:12345 TODO
stat显示UNKNOWN
# stat TODO
Uid: (12345/ UNKNOWN) Gid: (12345/ UNKNOWN)
ls显示ID
# ls -l TODO
-rw-r--r-- 1 12345 12345 6972 Dec 4 2013 TODO
Alluxio使用User & Group Name
如果系统中不存在该User或Group,则无法转换为ID,
目前折中的方案是使用挂载用户的User & Group ID
17. JD Contribution to Alluxio
17
Business
Strategy
ui-grid based
sort/pagination/filter add
an input field
New Web UI
high watermark start evict
low watermark stop evict
Watermark Evict Strategy
check startsup
check every time
Cache Consistency
monitor JVM pause periodically
log message and metrics
JVM Pause Monitor
cp/ls/load/rm/format
Shell Command
Deadlock
thrift add timeout time
…
Bugfix
shell
RESTful API
Change Log Level
SyncQuery
AlluxioTools
…
Test