aliyun / ossfs

Export s3fs for aliyun oss.
GNU General Public License v2.0
738 stars 152 forks source link

请问缓存机制是如何,本地已经存在的文件,再访问的时候看日志还是有网络请求 #52

Closed chillybss closed 7 years ago

chillybss commented 7 years ago

heartbeatcheck.txt这个文件本地已经有了,为什么看日志里面还是有网络请求

Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:s3fs_getattr(821): [path=/heartbeatcheck.txt] uid=0, gid=0, mode=100777 Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: [path=/heartbeatcheck.txt][flags=34816] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: delete stat cache entry[path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:check_parent_object_access(657): [path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:check_object_access(551): [path=/] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:get_object_attribute(405): [path=/] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:check_object_access(551): [path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:get_object_attribute(405): [path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: [tpath=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: [tpath=/heartbeatcheck.txt][bpath=][save=][sseckeypos=-1] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: curl.cpp:GetHandler(239): Get handler from pool: 31 Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: URL is http://oss-cn-qingdao-internal.aliyuncs.com/yeteammedia/heartbeatcheck.txt Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: URL changed is http://yeteammedia.oss-cn-qingdao-internal.aliyuncs.com/heartbeatcheck.txt Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: curl.cpp:RequestPerform(1791): connecting to URL http://yeteammedia.oss-cn-qingdao-internal.aliyuncs.com/heartbeatcheck.txt Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: HTTP response code 200 Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: curl.cpp:ReturnHandler(262): Return handler to pool: 31 Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: add stat cache entry[path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: cache.cpp:GetStat(171): stat cache hit [path=/heartbeatcheck.txt][time=1487914325][hit count=0] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:get_object_attribute(405): [path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: cache.cpp:GetStat(171): stat cache hit [path=/heartbeatcheck.txt][time=1487914325][hit count=1] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Open(1809): [path=/heartbeatcheck.txt][size=16][time=1487321638] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Open(710): [path=/heartbeatcheck.txt][fd=-1][size=16][time=1487321638] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Open(196): file locked(/heartbeatcheck.txt - /alidata1/ossfs_local_cache/.yeteammedia.stat/heartbeatcheck.txt) Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Release(212): file unlocked(/heartbeatcheck.txt) Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: [path=/heartbeatcheck.txt][fd=28][time=1487321638] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:s3fs_read(2063): [path=/heartbeatcheck.txt][size=4096][offset=0][fd=28] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:ExistOpen(1860): [path=/heartbeatcheck.txt][fd=28][ignore_existfd=false] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Open(1809): [path=/heartbeatcheck.txt][size=-1][time=-1] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Open(710): [path=/heartbeatcheck.txt][fd=28][size=-1][time=-1] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Dup(695): [path=/heartbeatcheck.txt][fd=28][refcnt=2] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Read(1418): [path=/heartbeatcheck.txt][fd=28][offset=0][size=4096] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Close(1901): [ent->file=/heartbeatcheck.txt][ent->fd=28] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Close(671): [path=/heartbeatcheck.txt][fd=28][refcnt=1] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: [path=/heartbeatcheck.txt][fd=28] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:check_parent_object_access(657): [path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:check_object_access(551): [path=/] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:get_object_attribute(405): [path=/] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:check_object_access(551): [path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: s3fs.cpp:get_object_attribute(405): [path=/heartbeatcheck.txt] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: cache.cpp:GetStat(171): stat cache hit [path=/heartbeatcheck.txt][time=1487914325][hit count=2] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:ExistOpen(1860): [path=/heartbeatcheck.txt][fd=28][ignore_existfd=false] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Open(1809): [path=/heartbeatcheck.txt][size=-1][time=-1] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Open(710): [path=/heartbeatcheck.txt][fd=28][size=-1][time=-1] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Dup(695): [path=/heartbeatcheck.txt][fd=28][refcnt=2] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: [tpath=][path=/heartbeatcheck.txt][fd=28] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Close(1901): [ent->file=/heartbeatcheck.txt][ent->fd=28] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Close(671): [path=/heartbeatcheck.txt][fd=28][refcnt=1] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: [path=/heartbeatcheck.txt][fd=28] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: [path=/heartbeatcheck.txt][fd=28] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Close(1901): [ent->file=/heartbeatcheck.txt][ent->fd=28] Feb 24 13:32:05 iZm5e0s7m7r0k69jqd34foZ s3fs[845]: fdcache.cpp:Close(671): [path=/heartbeatcheck.txt][fd=28][refcnt=0]

xuensheng commented 7 years ago

本地只缓存已经打开的文件的内容,如果文件被关闭,文件内容的cache就立即释放,本地不再缓存。

Seanspt commented 4 years ago

本地只缓存已经打开的文件的内容,如果文件被关闭,文件内容的cache就立即释放,本地不再缓存。

我们原来使用s3fs的时候,用到缓存,cpu就降下来了。 但是用ossfs,就算所有文件已经下载到缓存目录了,cpu依然很高,是这个原因吗? 理论上s3fs和ossfs在缓存处理上不应该是一样的吗。