为什么我经常看到“重置断开的连接"?将数据上传到我的数据库时? [英] Why do I constantly see "Resetting dropped connection" when uploading data to my database?

查看:38
本文介绍了为什么我经常看到“重置断开的连接"?将数据上传到我的数据库时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 REST API 从 Heroku 上的云服务器向 AWS EC2 中的数据库上传数亿个项目.我正在使用 Python,并且经常在日志中看到以下 INFO 日志消息.

I'm uploading hundreds of millions of items to my database via a REST API from a cloud server on Heroku to a database in AWS EC2. I'm using Python and I am constantly seeing the following INFO log message in the logs.

[requests.packages.urllib3.connectionpool] [INFO] Resetting dropped connection: <hostname>

在我的代码再次继续执行之前,这种重置断开的连接"似乎需要很多秒(有时超过 30 秒).

This "resetting of the dropped connection" seems to take many seconds (sometimes 30+ sec) before my code continues to execute again.

  • 首先,这里到底发生了什么,为什么?
  • 其次,有没有办法阻止连接断开,以便我能够更快地上传数据?

感谢您的帮助.安德鲁.

Thanks for your help. Andrew.

推荐答案

Requests 使用 Keep-Alive 默认.重置断开的连接,根据我的理解,意味着本应处于活动状态的连接以某种方式断开了.可能的原因有:

Requests uses Keep-Alive by default. Resetting dropped connection, from my understanding, means a connection that should be alive was dropped somehow. Possible reasons are:

  1. 服务器不支持Keep-Alive.
  2. 在已建立的连接中有一段时间没有数据传输,因此服务器断开连接.

有关详细信息,请参阅https://stackoverflow.com/a/25239947/2142577.

See https://stackoverflow.com/a/25239947/2142577 for more details.

这篇关于为什么我经常看到“重置断开的连接"?将数据上传到我的数据库时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆