Repository navigation
Config: Parallel for for inbounds' clients - #6055
Conversation
|
6053还能考虑 这个就太奇怪了 |
|
What? |
|
你们就不能考虑用API往core里加或者fork一份调Validator接口再接你们的user数据库么 什么都要塞到核心里来 |
|
So, in your opinion, adding 5 million users via the API will be faster than with the initial load from config? That's complete nonsense. 22 seconds is an excellent result. In the current release version, it takes an eternity, over a minute. |
|
build 配置文件那个是把单核 for 改成多核,不过只改 VLESS 的话有点脏,应当把这个能力抽象为一个函数然后每个入站都改 |
|
那个函数可以放 common utils 啥的,以后任何有这种 for 的地方都可以直接调用以优化性能 |
|
这么改非常奇怪 就挤出了那么十几秒几十秒的启动时间(相比改json解析器) 就为了那 "5 million users" 完全超出了本来的设计范畴 管理这么多用户本来就弄不了要上数据库的 这还在这力大砖飞 |
|
|
|
哎 赞助 |
|
这是一项通用能力啊,直接 for 确实是单核,现在能用多核来并行处理了,别的入站改一下也就套个函数而已 |
|
Function placed in /common/task Trojan, VMESS is also updated |
|
@kastov Hy 和 SS 也改一下吧 |
|
@RPRX added for SS, SS22 (without relay), Hysteria |
|
@kastov 我没看代码,WireGuard 是不是加不了,依稀记得它传了全部配置给外部库来着? |
|
|
|
Xray-core/infra/conf/wireguard.go Lines 80 to 90 in 7ab0a3c |
|
well, I'd like to ask you about replacing sync.Map with map + RWMutex. is this a good idea? do we write as often as read or more often? xray-core is not only used in commercial segment. have you tested the performance of creating a new connection? |
|
坏了,读极多的情况下貌似 sync.Map 性能更好,因为它是两份 map,并发读的时候就没锁 不过这里改成一个锁管两个 map 的话。。。我再看看,我留那个注释的意思应该是 email 可能写多读少,所以可以用读写锁 @kastov 你能测一下 benchmark 吗 |
|
I also looked at the golang source code, and it seems that it would be very impractical to abandon sync.Map even with frequent write operations |
|
@RPRX you are right. RWMutex gives us a ~30% startup speedup and dramatically fewer allocations on bulk insert, but sync.Map is faster on concurrent reads.
Let me revert validator.go to initial state for now. |
for for inbounds' clients
|
说起来我想把 inbounds 这些 |
Parallelize
VLessInboundConfig.Build()— per-client work (json.Unmarshal, UUID parse,proto.MarshalintoTypedMessage) is independent and now runs inruntime.GOMAXPROCS(0)worker goroutines viaerrgroup. Output order preserved (each worker writes to its own slice index).On a 5M-user config (single VLESS inbound):
Together with #6053 startup time drops even further on remote configs.