Hi
I’ve been using emoncms for a few months now and had it connected to home assistant for a single dashboard of all the data.
Now, for some reason the web requests to emoncms are taking 10s (curl -I https://emoncms.mydomain.com - this is not the real one!) , so HA is complaining (it has a timeout of 5s for its emoncms calls).
The system is a Pi3+, ubuntu 20.04 with an external SSD, with HA & emoncms running in docker, using an external mysql database for emoncms. There’s an nginx reverse proxy in front of docker.
I’ve rebuilt the docker container to the stable branch, so that is showing 10.7.0 (it was using 10.5.8 until I noticed the problem).
Comparatively, HA flies along, so it’s defo something in the emoncms container, but I’m not sure where I should look.
It may also help to say the emoncms dashboards load really, really slowly - as in about 10s per graph (of 8 on one screen).
Can anyone help?
My other option is running the container on a real machine with more grunt, but then again it did work fine when I first installed it.
Hello @Gadg3ts are you using mysql for feed data? or are your feeds listed as using the PHPFina engine? Does this affect all pages or only pages that need to load feed data?
Phpfina is fine, great. It’s been a while since Ive done any docker stuff, can you check to see if there are any processes using a lot of memory or processor? Can’t think of anything specific that would have slowed things down and I haven’t noticed any slow down here on my emonSD system running on a Pi3.
I would recommend using our emonSD builds over docker as the emoncms docker isn’t really maintained unfortunately.
Thanks @Gadg3ts I cant see anything wrong with that. I’ve started up the emoncms-docker container here and it seems to be pretty responsive, through of course that’s without data and lots of things posting to it.
I’m not sure that mysql fix is relevant - it looks like that’s for initialising the db? (which was already done as was running fine for several months).
The docker image build is based on a posting I found here (can’t find the original link), which basically takes the ‘official’ docker image as a base and then clones the current ‘stable’ branches into it. Dockerfile.txt (1.1 KB) docker-compose.yml.txt (1.0 KB)
The above are what I’m using right now.
So it’s the latest stable code…
I have a suspicion it’s not apache itself that’s being slow, but that I can debug. I was just hoping for an easy answer!
Might be worth trying the docker container here? GitHub - emoncms/emoncms-docker: Emoncms docker container(s) but looks similar to what you have there. Is there a chance the external mysql server is causing an issue, perhaps latency between the two?
Perhaps someone else here can suggest something else to try.
That link with the build script is actually where I started.
To get it usable again, I might just try building the container on a proper machine and see what that gives me. Then look at profiling the components to see where the bottleneck is.
I could be way off base here, but does your Admin / System Info indicate the RAM use is growing or any Swap memory is being used?
My emonPi system experienced interface slow-downs and they were related to growing RAM use that led to growing Swap use. For me, the problem was a buggered up emonhub.conf file in /etc/emonhub/. I found 3 sets of duplicate node definitions in the file. I deleted the duplicates and my system had been stable and responsive ever since.
To extend my answer, I rsync’ed the build folder (ok, the docker & compose files) to another machine (Intel cpu) and rebuilt the docker image, with the same result. As in it was really slow .Which is weird.
So for the moment I’ve got the EmonTX data working directly in home Assistant via MQTT sensors (which actually wasn’t that hard).