Windows上的性能问题mongo

时间:2016-05-30 10:37:09

标签: windows mongodb python-3.x

我们已经构建了一个视频存储在mongodb中的系统。这些视频的大小都是几百兆字节。该系统使用mongoengine在python3中构建。安装了pymongo和bson的c扩展。

mongoengine文件的定义是:

class VideoStore(Document, GeneralMixin):
    video = EmbeddedDocumentListField(SingleFrame)
    mutdat = DateTimeField()
    _collection = 'VideoStore'

    def gen_video(self):
        for one_frame in self.video:
            yield self._get_single_frame(one_frame)

    def _get_single_frame(self, one_frame):
        if one_frame.frame.tell() != 0:
            one_frame.frame.seek(0)
        return pickle.loads(one_frame.frame.read())


class SingleFrame(EmbeddedDocument):
    frame = FileField()

在Linux中阅读视频大约需要3到4秒。但是,在Windows中运行相同的代码需要13到17秒。

有没有人有这个问题和任何解决方案的经验?

我已经想过并测试过(无济于事):

  1. 增加chunksize
  2. 将视频作为单个blob读取而不使用yield
  3. 将文件存储为单个blob(因此不存储单独的帧)

1 个答案:

答案 0 :(得分:0)

使用Linux,Windows支持不足。使用“无限”虚拟内存等导致Windows变体出现问题。该主题进一步阐述: Why Mongodb performance better on Linux than on Windows?

相关问题