-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
High CPU usage on docker #262
Comments
I am having high RAM usage with Docker after running the bot for couple of hours. |
Maybe there is a way for us to not use docker? Like, start the bot right from terminal? |
The bot running in RPi4 uses 30~40% CPU as well, which makes sense since it's so low spec. But the bot running in i5/8GB Ubuntu server(18 Bionic Feaver) running 4~10% CPU only. It seems you are using Ubuntu 10 (Buster), which is very old. Is there any specific reason that you are using that version?
If you install redis/mongo separately, it is definitely possible, but I don't think that will benefit anyway because Docker itself uses native resources. |
Yes, there is a way for this but the problem is we have to install everything separately, such as mongodb and redis on our local OS. That's why I prefer Docker. |
Hm. Can you explain me how to do it? I would like to test it without the docker, as my machine has low ram (8gb), and docker eats it all, even with the wslconfig thing done. I think this will fix many problems, like:
But, as you said, docker manages it all, and it is compatible to multiple systems. I think it will benefit us. |
@pedrohusky Briefly, install Redis, Mongo. |
cat /etc/debian_version its Debian at its latest version.... Why do you think its old? |
Oh sorry, I thought it's Ubuntu.... Ubuntu Buster was v10. I am not sure why it is eating CPU up that much despite you also have i5/8G RAM. |
upgraded Debian 10.10 to 11.0 still high cpu load (about 40%). what changed between 0.0.65 and 0.0.66? @chrisleekrchangelog states:
|
@rayures Sorry for the late reply. @vuongductuanktmt My latest version in RPi is not even using 50%. |
I'm also using RPi 4 with latest bot version (0.0.74), same OS as yours but the container constantly exits and restarts itself, looks like the CPU is being excessively used From my Grafana monitor, you can see that the temperature is constantly getting up (around 40c), this is when the container is running, and down (around 35c), this is when the container is exiting and trying to restart, the Grafana is also slow to visit, I'm not sure if it's Docker problem, what should I do to fix it? looks like it's using around 20% cpu for node in top command but excessive cpu usage in docker stats |
Hey @bangbaew Can you try with disabling swap?
|
Ok, I'll try it and give you an update, |
Looks like the bot is still exiting and restarting... even I've disabled swapfile and block i/o is 0 bytes My RPi was really slow before the container exited, looked like it made my RPi temporarily down... what build stage are you using? I'm currently using the full production build stage. This is my compose file, I saw it was using development build stage with binance test mode when I downloaded it, |
Hmmm, I don't know why are you running docker-compose.yml.
FYI, I found it looks stuck at building step, but it is not, takes really long time to build. What I am trying to do is to distribute docker image for ARM/v7, which is RPi, then you won't need to build the image. Just need docker image. |
And for the restarting, have you looked at the log? |
Because I used docker-compose.rpi.yml and it pulled your image from the docker hub which was build for x86 and it ended up with standard_init_linux.go:219: exec user process caused: exec format error like this thread but I didn't understand the npm run docker:build command so I didn't run it, I thought it was like normal Dockerfile building, so I used build: . instead, it didn't stuck but it just took a quite long time to build. I'll try to use npm run docker:build |
I've tried npm run docker:build, I think it's the same as normal Dockerfile building as I usually do, the container was still crashing, I think the problem is with monitoring symbols every second, which consumes a lot of cpu, because I had more than 30 symbols monitoring simultaneously and the timer took a long time to refresh before crashing, so I cleaned the volumes to default 4 symbols monitored, the bot works smoothly, the timer increases second by second without crashing. Can you add the option to adjust monitoring interval? I think it could be monitored every minute like the bot before monitoring-coins-simultaneously release. my RPi worked great with that version. |
I really don't think it's the issue with the bot because I use it without much hassle. What SD card are you using? Are you using 10 Speed Class?
Crashing is not making sense as well. Have you checked the log? What did the log say when it's crashed? In anyway, if you want to increase interval, refer these environments parameters you can set. https://github.com/chrisleekr/binance-trading-bot/blob/master/config/custom-environment-variables.json#L86 |
The log didn't say error messages, they were just normal bot messages log but it was so slow logging and eventually crashed so I didn't capture any screenshot of it, my SD card is SanDisk class 10 UHS-I thanks for suggesting me the environment variable, may I ask what's the unit of it? seconds? |
The variable values can be referred in this file - https://github.com/chrisleekr/binance-trading-bot/blob/master/config/default.json#L50 It's crontab with milliseconds. |
thnx for the reply. as a test i increased the delay in the default config ( crontime ) to double the amount. Can see it directly in cpu usage. Switching between 2% and 40%. So it definitely is the coin updates. |
I've set BINANCE_JOBS_TRAILING_TRADE_CRON_TIME=*/10 * * * * * from 10:46 to 11:00 was when I set crontime to 10 seconds (< 25% cpu usage), the rest were every second (<= 75%). but I don't quite understand what BINANCE_JOBS_TRAILING_TRADE_INDICATOR_CRON_TIME does, |
As I said, this cronjob is supporting seconds as well. So it's 6 *, which means every second. If you set
|
Do you have 30++ symbols monitored simultaneously every second? It's really consuming the CPU. |
I also restart the bot every 3 hours in Raspberry Pi, but it's not because of the performance. I do that because of the local tunnel. |
Hey, Can you check the redis log whether you see the below message?
|
currently i am running pedrohusky fork, that one runs about 1% cpu (all containers combined). Will try to switch back and look at the redis log. |
|
What I found is, Redis is trying to save the changes to the disk so it doesn't lose the data. It's called AOF.
Since Raspberry Pi is not using SSD or a faster disk, it causes a bottleneck. A Redis is just a temporary cache, it should be able to flush anytime. I am testing the code with the following changes:
Although it's not improving performance in the Raspberry Pi significantly since it still requires read/write to MongoDB for some features. However, at least Redis would not write to the disk anymore as it shouldn't be. |
I assume this is no longer the issue. I will close the issue. |
Version
latest docker
chrisleekr/binance-trading-bot:latest@sha256:d79e5410e42884eee835f652fb78c8c7c5bbe814bad3967057cd6d5f5ed96ce5
Running Version: v0.0.74 (67a4adf)
Latest Version:
v0.0.74
Description
the binance trade bot docker container is continuously using 30-40 % cpu time. (top in host, and docker stats on host). Host is a 4 core i5 machine. No limits on the container.
host:
i5 4c
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-17-amd64
Architecture: x86-64
docker:
Docker version 19.03.5, build 633a0ea838
docker stats:

in the binance bot container:

is this normal behavior?
The text was updated successfully, but these errors were encountered: