Open jeasonHu opened 1 month ago
@jeasonHu, few things:
Note, setting ClientNetWriteBufferSize and ClientNetReadBufferSize to 0 equals to 2KB.
@jeasonHu, few things:
- are your clients MQTTv3 or v5?
- can you verify these clients between step 3 and 4 in fact disconnected from the server? You can check the SysInfo.
- what's the value set for MaximumMessageExpiryInterval?
Note, setting ClientNetWriteBufferSize and ClientNetReadBufferSize to 0 equals to 2KB.
@thedevop
clients_connected
and clients_total
in sysinfo
have returned to their initial states. MaximumMessageExpiryInterval
to 60, and configured ClientNetWriteBufferSize
and ClientNetReadBufferSize
to 1024.If both MaximumMessageExpiryInterval and MaximumSessionExpiryInterval are set to 60, the server should release all the memory used by the clients (however Go may not release the memory back to OS).
There are 2 other possibilities:
In the process of testing and verifying, found some memory problem; The following are the test steps 1. start server in k8s with 2 pod 2. Initiate 2000 connection requests,when execution is complete close test client 3. few minutes later Initiate 3000 connection requests,when execution is complete close test client 4. repeat step 3
The memory usage:
After performing steps 2、3 Test client has close, all clients has disconnected,bus memory not recovery enough ,causing a backlog; then exec steps 4 the memory exceeded the limit, causing the service to restart.
Code:
github.com/mochi-mqtt/server/v2 v2.6.5
` capabilities := mqtt.NewDefaultServerCapabilities() capabilities.MaximumSessionExpiryInterval = 60 capabilities.MaximumInflight = 1024 capabilities.MaximumClientWritesPending = 256
I'm not sure what caused this issue. I made some configuration changes based on the example code.