Comments (19)
应该是GC不及时的问题,是不是一个低端CPU?
可以启动时增加环境变量,例如GOGC=20 ./client_xxxxx
,提高回收频率。
from kcp-go.
两个可以设置的环境变量。
The GOGC variable sets the initial garbage collection target percentage. A collection is triggered when the ratio of freshly allocated data to live data remaining after the previous collection reaches this percentage. The default is GOGC=100. Setting GOGC=off disables the garbage collector entirely. runtime/debug.SetGCPercent allows changing this percentage at run time.
The GOMEMLIMIT variable sets a soft memory limit for the runtime. This memory limit includes the Go heap and all other memory managed by the runtime, and excludes external memory sources such as mappings of the binary itself, memory managed in other languages, and memory held by the operating system on behalf of the Go program. GOMEMLIMIT is a numeric value in bytes with an optional unit suffix. The supported suffixes include B, KiB, MiB, GiB, and TiB. These suffixes represent quantities of bytes as defined by the IEC 80000-13 standard. That is, they are based on powers of two: KiB means 2^10 bytes, MiB means 2^20 bytes, and so on. The default setting is math.MaxInt64, which effectively disables the memory limit. runtime/debug.SetMemoryLimit allows changing this limit at run time.
from kcp-go.
好像还是不太行。会跑飞,云上机器4c8g。
GOGC=50 GOMEMLIMIT=5368709120 nohup ./linux_server &
还是跑飞了...
from kcp-go.
不用nohup呢,nohup我不确定会不会继承环境变量。你可以用tmux
from kcp-go.
GOGC再小点,GOGC=10
from kcp-go.
我自用的1c2g都没事
from kcp-go.
直接 GOGC=10 GOMEMLIMIT=4368709120 ./linux_server也崩了。。。 估计是我请求太频繁、流量太多导致的?
nohup是可以继承的
from kcp-go.
cpu跑满了么
from kcp-go.
cpu 持续 200% +
from kcp-go.
那就是某种原因导致了cpu全部消耗了,并且没有多余的时间用于GC,要么是配置错误,要么就是持续超高流量,那确实就是需要这么多内存和CPU
from kcp-go.
配置错误是指?
from kcp-go.
例如interval, fec, fastack这类通信参数
from kcp-go.
好像都是没设置,和kcp相关的,就只设置了下面这些:
conn, err := uln.AcceptKCP()
if err != nil {
log.Error().Msg(err.Error())
continue
}
conn.SetStreamMode(true)
conn.SetWriteDelay(false)
conn.SetNoDelay(1, 10, 2, 1)
conn.SetWindowSize(128, 128)
conn.SetACKNoDelay(true)
from kcp-go.
conn.SetACKNoDelay(true) 这个不需要设置
from kcp-go.
下午刚对着你的 kcptun 加上的 哈哈
from kcp-go.
除了这个选项,直接改sess.go
的话,有什么建议么?
from kcp-go.
没有,主要是找到cpu满载的原因
from kcp-go.
估计是交互量太大导致的。
我改了下面俩,然后,似乎现在稳定了。
conn.SetNoDelay(0, 20, 0, 0)
conn.SetWindowSize(256, 256)
from kcp-go.
大概知道了,可能是得在udp收数据的地方加一个判断,判断是会否kcp相关上数据,不然每个包都进去,量级太多的时候,就释放不过来了。
结单,感谢大佬
from kcp-go.
Related Issues (20)
- DATA RACE in xmitBuf sync.Pool
- Crypto Go :we are a research group to help developers build secure applications.
- 比原版kcp多了early retransmit目的是什么? HOT 1
- 是不是可以修改session的fec配置? HOT 2
- is there a way to support non-block read?
- Write方法返回时不能保证数据写到了对方缓冲区 HOT 7
- Add exam in examples
- UDPSession.WriteBuffers里面的timeout 有内存泄漏风险 HOT 2
- why IKCP_OVERHEAD is 24bytes HOT 2
- Just need some help and explanation
- write to non-existent host does not cause an error
- packetInput 允许用户自行处理解码失败的UDP包
- is it possible to disable ack, for use in unidirectional network.
- 希望Listener上能提供一个NewUdpSession的方法
- 如何提升kcp的速度? HOT 4
- 为什么一重启服务器端,就收不到客户端传来的信息呢
- 服务器链接超过某个数后内存暴涨 HOT 1
- 如何抵御重放攻击(How to defend against replay attacks)? HOT 1
- 用户数据过大时,会出现数据错乱问题 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kcp-go.