-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: APISIX3.5 has high memory usage problems #10349
Comments
thx, you Report. pls assgin to me . reproduce stepSuccessfully reproduced design
install APISIX 3.5.0folllow cmd run@ sudo yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm
sudo yum-config-manager --add-repo https://repos.apiseven.com/packages/centos/apache-apisix.repo
sudo yum install apisix-base-1.21.4.1.8
sudo yum install apisix-3.5.0 install route[root@localhost ~]# cat httpbin-anything.json
{
"methods": [
"GET"
],
"uri": "/anything",
"upstream": {
"type": "roundrobin",
"nodes": {
"192.168.31.191:38080": 1
}
}
}
[root@localhost ~]# curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d @/root/httpbin-anything.json |jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 419 0 276 100 143 4307 2231 --:--:-- --:--:-- --:--:-- 4451
{
"key": "/apisix/routes/1",
"value": {
"methods": [
"GET"
],
"update_time": 1697698947,
"uri": "/anything",
"upstream": {
"type": "roundrobin",
"nodes": {
"192.168.31.191:38080": 1
},
"hash_on": "vars",
"scheme": "http",
"pass_host": "pass"
},
"create_time": 1697685866,
"priority": 0,
"status": 1,
"id": "1"
}
} install benchmark toolsinstall https://github.com/giltene/wrk2 as benchmark tools send request to ./wrk -t2 -c100 -d10000s -R200000 --latency http://192.168.122.145:9080/anythinga get the slab info from 11886 11886 100% 0.57K 849 14 6792K radix_tree_node 13692 13692 100% 0.57K 978 14 7824K radix_tree_node and ubuntu@ubuntu-server:~/wrk2$ ./wrk -t2 -c100 -d10000s -R200000 --latency http://192.168.122.145:9080/anythinga
Running 167m test @ http://192.168.122.145:9080/anythinga
....
166199.295 1.000000 5290366 inf
#[Mean = 77988.014, StdDeviation = 43686.962]
#[Max = 166068.224, Total count = 5290366]
#[Buckets = 27, SubBuckets = 2048]
----------------------------------------------------------
5634121 requests in 3.17m, 1.18GB read
Non-2xx or 3xx responses: 5634121
Requests/sec: 29613.49
Transfer/sec: 6.35MB to insepct the slab info . and found the slab not be recycle
swith to correct route ubuntu@ubuntu-server:~/wrk2$ ./wrk -t2 -c100 -d10000s -R200000 --latency http://192.168.122.145:9080/anything
Running 167m test @ http://192.168.122.145:9080/anything
2 threads and 100 connections inpsect 13720 13720 100% 0.57K 980 14 7840K radix_tree_node stop benchmark with correct url. Found that 13748 13748 100% 0.57K 982 14 7856K radix_tree_node The memory did not decrease quickly, so switch to the wrong URL for stress testing. ubuntu@ubuntu-server:~/wrk2$ ./wrk -t2 -c100 -d10000s -R200000 --latency http://192.168.122.145:9080/anythinga
Running 167m test @ http://192.168.122.145:9080/anythinga
2 threads and 100 connections
Thread calibration: mean lat.: 4034.417ms, rate sampling interval: 14827ms
Thread calibration: mean lat.: 4074.969ms, rate sampling interval: 14852ms Memory increases very quickly 14574 14574 100% 0.57K 1041 14 8328K radix_tree_node about 10 minutes later 16870 16870 100% 0.57K 1205 14 9640K radix_tree_node 16884 16884 100% 0.57K 1206 14 9648K radix_tree_node |
Stage information:
further processing
|
@Sn0rt thanks for the detailed information. |
Combining your information, I very much suspect that the problem was introduced in 3.4; combined with the changelog, I guess it is caused by the modification of etcd. Can you help me test it? (I tried to reproduce it on centos but failed. ) Use the 3.3 etcd file to replace the 3.5 one. Take a look at wget https://raw.githubusercontent.com/apache/apisix/release/3.3/apisix/core/config_etcd.lua |
OK, I'll try to reproduce & test it |
@deluxor we are tracking this problem, do you have any more clues? |
I will close this issue since it has been fixed |
Current Behavior
Since using APISIX3.5, the memory has been growing continuously, as shown in the figure below.


Using the slabtop command, you can see that radixtree occupies a high amount of space.
There is no such problem on APISIX2.9 or APISIX3.3.
Expected Behavior
No response
Error Logs
No response
Steps to Reproduce
Freshly install and run APISIX3.5,then use ETCD as data surface.
Environment
apisix version
):3.5uname -a
):openresty -V
ornginx -V
):openresty/1.21.4.1curl http://127.0.0.1:9090/v1/server_info
):luarocks --version
):The text was updated successfully, but these errors were encountered: