V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  aladdinding  ›  全部回复第 3 页 / 共 13 页
回复总数  242
1  2  3  4  5  6  7  8  9  10 ... 13  
2023-04-20 13:43:51 +08:00
回复了 iorilu 创建的主题 程序员 现在还有多少开发觉得一定要用 mac 的
win 找个好用的剪切板历史都找不到
2023-04-07 14:07:25 +08:00
回复了 Andor_Chen 创建的主题 推广 送几本“通透”的《流畅的 Python (第 2 版)》
冲冲冲
2023-04-03 15:49:08 +08:00
回复了 aladdinding 创建的主题 问与答 go net/http transport 内存泄漏
@picone 准确的说还有 proxy

// connectMethod is the map key (in its String form) for keeping persistent
// TCP connections alive for subsequent HTTP requests.
//
// A connect method may be of the following types:
//
// connectMethod.key().String() Description
// ------------------------------ -------------------------
// |http|foo.com http directly to server, no proxy
// |https|foo.com https directly to server, no proxy
// |https,h1|foo.com https directly to server w/o HTTP/2, no proxy
// http://proxy.com|https|foo.com http to proxy, then CONNECT to foo.com
// http://proxy.com|http http to proxy, http to anywhere after that
// socks5://proxy.com|http|foo.com socks5 to proxy, then http to foo.com
// socks5://proxy.com|https|foo.com socks5 to proxy, then https to foo.com
// https://proxy.com|https|foo.com https to proxy, then CONNECT to foo.com
// https://proxy.com|http https to proxy, http to anywhere after that
type connectMethod struct {
_ incomparable
proxyURL *url.URL // nil for no proxy, else full proxy URL
targetScheme string // "http" or "https"
// If proxyURL specifies an http or https proxy, and targetScheme is http (not https),
// then targetAddr is not included in the connect method key, because the socket can
// be reused for different targetAddr values.
targetAddr string
onlyH1 bool // whether to disable HTTP/2 and force HTTP/1
}
2023-04-03 15:38:35 +08:00
回复了 aladdinding 创建的主题 问与答 go net/http transport 内存泄漏
@Reficul MaxIdleConns MaxIdleConns 默认都是 0 ,没有限制的
2023-04-03 15:37:57 +08:00
回复了 aladdinding 创建的主题 问与答 go net/http transport 内存泄漏
@sadfQED2 加了 DisableKeepAlives:true 临时解决的
2023-04-03 15:37:34 +08:00
回复了 aladdinding 创建的主题 问与答 go net/http transport 内存泄漏
@aladdinding 对外请求是很多域名+不同的 http 代理
2023-04-03 15:36:45 +08:00
回复了 aladdinding 创建的主题 问与答 go net/http transport 内存泄漏
@picone transport 加了 DisableKeepAlives:true 就没有内存泄漏了,

但是我看代码,加了后会在 header 加入 connection:close ,如果目标网站识别到 close ,主动关闭连接的话,就用不了长连接了

对外请求是很多郁闷,而且还有很多代理,通过 connectMethodKey 来看,连接池会有很多连接,但是我设置了 IdleConnTimeout 为 15s 了,应该也不会出现内存泄漏
2023-04-03 10:57:34 +08:00
回复了 aladdinding 创建的主题 问与答 go net/http transport 内存泄漏
@picone 是用了连接池,内存变化是缓慢增长,看 github 也是有一样的 issue ,但是也没讲出问题原因是什么
2023-03-27 09:40:20 +08:00
回复了 cxykhaos 创建的主题 程序员 新手一起交流 golang
google 一分钟,吹水一小时
在 net/http 标准库中,http.Request 中的 WithContext 方法会返回一个新的 http.Request 对象,它会将原始的请求对象复制一份,然后将新的上下文信息赋值给新的请求对象。这样做的原因是为了确保新的请求对象与原始请求对象是完全独立的,以避免在并发处理请求时可能出现的竞争条件。

具体来说,WithContext 方法会浅拷贝一份原始请求对象的所有字段,包括头部、URL 、请求体等等。然后它会将新的上下文信息赋值给新的请求对象的上下文字段,这个操作是通过直接赋值来完成的。因为上下文信息通常只是一个指针类型的数据结构,因此它的复制是非常快速和低成本的,因此可以直接进行赋值操作。

通过浅拷贝一份请求对象,可以确保新的请求对象与原始请求对象是独立的。这意味着对新的请求对象的任何修改都不会影响原始请求对象,反之亦然。这在处理并发请求时非常重要,因为多个并发请求可能会同时修改同一个请求对象,这可能会导致不可预料的结果。通过确保每个请求对象都是独立的,可以避免这种情况的发生,从而提高程序的稳定性和可靠性。

FROM ChatGPT
我也有这个问题诶
2023-02-24 10:07:04 +08:00
回复了 Nazz 创建的主题 程序员 我们真的需要 gRPC 吗?
是的 我们需要
2023-02-20 18:38:44 +08:00
回复了 chinesehuazhou 创建的主题 Python 《这一次, Python 真的有望告别 GIL 锁了?》
多开几个 python 进程 0.0
2023-02-17 13:37:30 +08:00
回复了 tengxunkuku 创建的主题 NAS B 站某百万粉丝 up 发布视频后, nastool 作者删库了
有人分享一下 tg 么
2023-02-06 10:56:34 +08:00
回复了 soupu626 创建的主题 程序员 Go 写业务真的是好的选择吗
不会做抽象么 照着逻辑硬写当然不舒服(想写屎山那没办法)
2023-01-28 18:32:09 +08:00
回复了 James107 创建的主题 Android 跪求大佬帮我给年迈的老妈选个合适的手机
小米 k40s 完美 到手之后自己觉得也不错 又买了个自用
小米计算器自带
2023-01-03 18:50:29 +08:00
回复了 Features 创建的主题 桂林 买房子,存款嗖的一声全刷了
24w 羡慕
2022-12-28 16:21:46 +08:00
回复了 aladdinding 创建的主题 问与答 golang 怎么重写标准库内的代码呢
@rimutuyuan 可以是可以,0.0 还要改一大堆导包了
2022-11-24 09:27:29 +08:00
回复了 Danswerme 创建的主题 Windows 抛弃黑苹果,重回 Windows 怀抱
如果 window 有 alfred 我也切换到 window
1  2  3  4  5  6  7  8  9  10 ... 13  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2954 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 32ms · UTC 00:41 · PVG 08:41 · LAX 17:41 · JFK 20:41
Developed with CodeLauncher
♥ Do have faith in what you're doing.