aiohttp - Aiohttp 性能写入大 blob?
问题描述
我正在使用 aiohttp.web.StreamResponse 来编写大型数据块(~100MB)。从功能上讲,它运行良好,但我很惊讶地看到写入性能(从构造函数到 write_eof 的测量值)达到 80MB/s 左右(客户端运行在同一台机器上和 localhost 端点)。
写代码是这样的:
resp = StreamResponse()
resp.headers['Content-Type'] = "application/octet-stream"
resp.content_length = len(output_data)
await resp.prepare(request)
await resp.write(output_data)
await resp.write_eof()
这是最佳性能的最佳选择吗?什么可以限制吞吐速度?
解决方案
推荐阅读
- flutter - Dart:对象与函数什么是最好的实现选择
- c - 如何将命令行参数中给出的整个单词数组直接传递给函数?
- matplotlib - 转换方法 transFigure 如何放置我的文本?
- python - 如何保持精灵的方向?
- mysql - 为什么组合计数查询执行时间过长?
- android - Koin java.lang.NoClassDefFoundError:解析失败:Lorg/koin/dsl/context/ParameterHolderKt
- javascript - VUE.JS 壮举。速度.js。未能在转换挂钩上实现自定义转换
- ios - 有什么方法可以使用 SwiftUI 创建 BottomBar
- python - 如何提取文本中的文本
带标签
- swift - 如何在 RealityKit 中为模型的旋转设置动画?