V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · 1540 views
    This topic created in 2477 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   ·   Solana   ·   2966 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 15:25 · PVG 23:25 · LAX 08:25 · JFK 11:25
    ♥ Do have faith in what you're doing.