推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
sunhk25
V2EX  ›  Python

如何优雅的把 numpy 向量数组的结果放到服务器的内存中

  •  
  •   sunhk25 · Jul 16, 2019 · 1862 views
    This topic created in 2628 days ago, the information mentioned may be changed or developed.

    Flask 的 uwsgi 服务器,做文章相似检索。

    • 250 维空间(float16)*100 万的语句大小有 1GB 左右,经测试有如下结果:
    • structpack < numpy < pickle < mongo.GridFS
    • numpy 数组的保存和读取效率可以说最佳,save:1.5s ,load:0.35s 。
      • uwsgi 的缓存机制和 numpy 的效果差不多
    • 可以通过一定程度的降维来减小向量文件的大小,然而每次请求来的时候都需 load 处理,
    • 不知道 uwsgi 服务器能不能把要计算的内容事先读到内存,然后每次请求时拿过来直接计算?
    2 replies  •  2019-07-16 18:59:02 +08:00
    sunhk25
        2
    sunhk25  
    OP
       Jul 16, 2019 via Android
    @arrow8899 这个需要研究一下,看看跟我用的缓存机制是否一样
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2556 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:27 · PVG 20:27 · LAX 05:27 · JFK 08:27
    ♥ Do have faith in what you're doing.