CentOS 7 使用tmpfs优化应用服务缓存读写速度

Posted by Sunday on 2018-08-01

tmpfs : 使用内存作为Linux磁盘文件,用于缓存读写。
操作

1
2
vim /etc/fstab
tmpfs /tmp tmpfs size=2G,noatime,nodiratime 0 0

挂载

1
mount -a

效果

1
2
df -h | grep /tmp
tmpfs 2.0G 216K 2.0G 1% /tmp

现在就可以将nginx 或 php缓存目录 指向/tmp了。