redis花了太多时间在数据库中放置一个大列表

vlurs2pr  于 2021-06-09  发布在  Redis
关注(0)|答案(0)|浏览(240)

所以我有一个列表,列表中有很多随机数。我将字节转换为一个列表,以便将其保存在redis数据库中。源文件\u to \u put-二进制数据

file_to_put = list(file_to_put)
        print(type(file_to_put))
        file_to_download = "downloadable" + str(id)
        redis_server.rpush(file_to_download, *file_to_put)
        print(type(redis_server.lrange(file_to_download,0, -1)))
        print(redis_server.lrange(file_to_download,0, -1))

当我试图打印 typeredis_server.lrange(file_to_download,0, -1) (也只是 redis_server.lrange(file_to_download,0, -1) )服务器冻结。一分钟后我会在日志里看到这个请求。当我试着 50kb 它工作的数据库文件。但当我试着把例如 5mb 只是需要很长的时间来加载。有人对怎么做有什么建议吗?也许用另一种方式保存?
更新
好吧,那就有了 5207154 (5.2mil) 列表中的元素。通过redis纪录片,你可以 4294967295 (4.2bil) 所以我似乎不能完全理解这个问题。因为520万与42亿相比,不应该花这么长时间把它放到db里

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题