Http POST请求需要花费大量时间才能完成-net/Http-Go

Http POST请求需要花费大量时间才能完成-net/Http-Go,post,go,net-http,Post,Go,Net Http,我在Go中使用net/http,我的一个HTTPS POST请求需要大约16秒的时间才能完成。虽然后端服务器处理只需要2.2秒,但整个过程(当响应在完全处理后从REST API接收时)大约需要16秒 我的电话看起来像: https://xxxxx.com/abcded 主体有一个JSON,其中包含一个大小约为1.68MB的GIF文件base64 { "username": "test", "update_username": "0", "name": "test name",

我在Go中使用net/http,我的一个HTTPS POST请求需要大约16秒的时间才能完成。虽然后端服务器处理只需要2.2秒,但整个过程(当响应在完全处理后从REST API接收时)大约需要16秒

我的电话看起来像:

https://xxxxx.com/abcded
主体有一个JSON,其中包含一个大小约为1.68MB的GIF文件base64

{
  "username": "test",
  "update_username": "0",
  "name": "test name",
  "isprivate": "0",
  "avatar_url": "",
  "description": "I am Test , updated using api ",
  "location": "test world",
  "phone": "12345678",
  "age": "23",
  "gender": "m",
  "update_profilepic": "1",
  "profilepic_lat": "28.593",
  "profilepic_lon": "77.1981",
  "profilepic_height": "480",
  "profilepic_width": "480",
  "profilepic_type": "photo",
  "profilepic": "Dummy String due to Size Constraint in StackOverFlow"
}
详情:

POST请求是在16:59:00.100从客户端(邮递员)调用的,但服务器在16:59:13.240接收到该调用(如下面的服务器日志所示)。最后,服务器完成所有处理,并在16:59:15.073回复。最后,我在16:59:15.773收到了客户(邮递员)的回复代码

Server Logs Start *****************************************

16:59:13.240
Just Entered into AUTHENTICATION method
16:59:13.246
--------------In Profile Related--------------
16:59:13.246
--------------In Edit Setting--------------
16:59:13.363
---------- In Edit Setting --------
16:59:13.363
Username direct rcvd :%!(EXTRA string=morninglad)
16:59:13.363
Username rcvd :%!(EXTRA string=morninglad)
16:59:13.363
Name rcvd :%!(EXTRA string=morning)
16:59:13.363
Update NON USER NAME UPDATE FLAG RCVD
16:59:13.363
About to call Update Query
16:59:13.374
About to Update the Profile Pic as found the flag
16:59:13.374
Updating the Profile Pic------------
16:59:14.906
About to Insert Media into DB
16:59:14.906
Got the GeoHash :%!(EXTRA string=ttnc9j3tgujw)
16:59:14.952
Found location :%!(EXTRA string=Gurugram)
16:59:14.955
Media Play value is :%!(EXTRA string=)
16:59:14.955
Username :%!(EXTRA string=morninglad)
16:59:14.983
Updating the Profile Pic Done ------------
16:59:14.983
Profile Pic Updated !
16:59:15.041
-------------------Fetch Avatars-----------------
16:59:15.073
The Avatar URL got :Avatar1
16:59:15.073
The Avatar URL got : Avatar2
16:59:15.073
---------- In Edit Setting DONE - END --------
16:59:15.073
--------------Response SENT--------------

Server Logs End *****************************************
所以,如果按照上面提到的时间戳,那么到达服务器的时间几乎是13秒,服务器的总处理时间大约是2秒。最终在1秒内收到了响应代码。所以这个呼叫的总时间大约是16秒

所以我想弄明白为什么呼叫服务器需要13秒

当我用较小的主体调用相同的调用时,即从1.68MB的GIF到1.4KB的JPEG,总时间大约为2.2秒。那么,我应该假设这个身体尺寸是增加时间的原因吗

但对于我正在使用的互联网(下载速度为72.33 Mbps,上传速度为6.07 Mbps),这听起来很奇怪


如果我在这里做错了什么,有什么指示吗?

你也检查过你的服务器吗?它对接收请求也有限制。@KorbenDallas服务器很好,我已经检查过了。您是如何检查的?您是否尝试将GIF直接下载到服务器而不使用
scp
例如?您是否也检查了您的服务器?它对接收请求也有限制。@KorbenDallas服务器很好,我已经检查过了。您是如何检查的?您是否尝试过将GIF直接下载到服务器,而不使用
scp