Openhab on PI Zero W 2, systemd mem limitation

Hi all,

just tried openhab on a pi zero w 2, it’s running smooth, however, it did not manage to run 24h until whole pi crashes. wlan connection dropped, journald was not persistent, so no real reason known till now.

Therefore I thought about limitting the openhab systemd service, tried it out and set it to 360M.
Since then, everything seems to work and its running fine (at least for a couple of hours and from what I’ve seen and tried so far).

You have any concern in limiting the systemd ram usage?

Thanks in advance!

No idea on your question but am interested to know what size you have made the heap be set to? My system would not run on under 250 to 300mb heap size which only leaves 200mb for the OS and some cache and other stuff.

Interested how it goes but personally 512mb of ram is just not enough unless it is a very simple setup and you tweak settings to make it work.

what do you mean by systemd mem limit ?
I guess that as systemd cannot know about application mem needs, it will just kill (eventually restart) the process when it grows beyond the limit. That for sure is the wrong way to tackle.
You can try to reduce heap mem usage (-Xm parameter to java off the head) but in the end it means you are trying to compensate a bad hardware selection decision. As @matt1 said a Zero just does not have enough RAM for a decent setup.

Hi @matt1, @mstormi,

I did not change the heap size or anything from the JVM.

First I had the same in mind like @mstormi , that the OS will terminate the service, but it didn’t.
When I’m not mistaken, since Java 11, java can read the systemd configuration and based on that, force the GC more heavily.

Of cause @mstormi you’re right, the PI Zero is not the way to go for a decent setup.
Currently I’m just running a PI Zero 24/7 cause I do not have further space and a free power socket in the switch cabinet. As my “Setup” is not critical (at least right now) I just thought about, maybe I can migrate all my stuff to the new Zero 2 and in addition let my small openhab instance also run on it.

Here my current content from OH3:
46 Things
465 Items
15 Bindings
13 Rules
+couple of python scripts for webscrapping etc.

so setting the limits for the systemd service:

sudo systemctl edit openhab.service

. include /usr/lib/systemd/system/openhab.service

e.g. systemd for Administrators, Part XVIII.

with these settings, it at least didn’t crash since yesterday evening and everything is running smoothly.

will still monitor it in the next upcoming days and give you some further feedback.

If you want me to try out some stuff, pls let me know.


Depends on some more parameters. There’s a parameter that forbids the process to allocate more mem so it does not grow any more and eventually never gets killed.

Java heap size is dynamically set it depends on available RAM. It may take environment limits into account (which are set via systemd).
But the recommended means is to directly limit heap size using -Xm as I wrote.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.