首页 > 解决方案 > dask.s3fs 是否真的使用缓存?

问题描述

当您调用S3FileSystem().open(..., fill_cache=True)它时,它看起来仍然进入 S3,仍然进行 ssl 握手等。这是它不缓存的预期行为吗?

标签: amazon-s3daskpython-s3fs

解决方案


fill_cache选项具有非常特定的含义

    If seeking to new a part of the file beyond the current buffer,
    with this True, the buffer will be filled between the sections to
    best support random access. When reading only a few specific chunks
    out of a file, performance may be better if False.

即,只有当您在文件保持打开状态时随机访问文件的某些部分时,它才会有所不同。无论如何,都需要初始 SSL 连接/握手,唯一可能改变的是请求的字节的确切范围。

另请注意,s3ss 使用 boto Session,因此 SSL 连接通常应在可能的情况下进行池化和重用。


推荐阅读