V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2019-07-16 10:41:37 +08:00 · 1127 次点击
    这是一个创建于 1740 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    • 250 维空间(float16)*100 万的语句大小有 1GB 左右,经测试有如下结果:
    • structpack < numpy < pickle < mongo.GridFS
    • numpy 数组的保存和读取效率可以说最佳,save:1.5s ,load:0.35s 。
      • uwsgi 的缓存机制和 numpy 的效果差不多
    • 可以通过一定程度的降维来减小向量文件的大小,然而每次请求来的时候都需 load 处理,
    • 不知道 uwsgi 服务器能不能把要计算的内容事先读到内存,然后每次请求时拿过来直接计算?
    2 条回复    2019-07-16 18:59:02 +08:00
    arrow8899
        1
    arrow8899  
       2019-07-16 10:53:22 +08:00
    sunhk25
        2
    sunhk25  
    OP
       2019-07-16 18:59:02 +08:00 via Android
    @arrow8899 这个需要研究一下,看看跟我用的缓存机制是否一样
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2719 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 05:17 · PVG 13:17 · LAX 22:17 · JFK 01:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.