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
myKing
V2EX  ›  Python

django 并发下载图片优化

  •  
  •   myKing · 2019-02-22 10:46:10 +08:00 · 1700 次点击
    这是一个创建于 1861 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我想问问我的 django 框架 在服务器 5m 网址 20 并发时获取 500kb,使用 fileresponse 返回图片是,平均获取 10s,这个怎么优化

    服务器配置:阿里云 cpu 8 核 内存 32g 网速 5m

    3 条回复    2019-02-22 11:15:48 +08:00
    kkjinping
        1
    kkjinping  
       2019-02-22 11:13:23 +08:00
    图片很大? 5M 的网 500K 速度差不多也快到头了
    aniua
        2
    aniua  
       2019-02-22 11:14:06 +08:00
    下载图片用 Nginx 等 Web 代理取代,资源安全性通过动态修改文件名实现。
    xpresslink
        3
    xpresslink  
       2019-02-22 11:15:48 +08:00
    是静态图片么?
    理论上说根本不应该让 django 来做提供静态图片的服务。
    应该直接用 Nginx 直接来处理静态图片。最好直接用阿里云的 OSS 打开静态网站功能,还能开启 CDN 加速。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1398 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 17:31 · PVG 01:31 · LAX 10:31 · JFK 13:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.