Restore on startup if electicity goes down mapdb

I would advise against that. The value of ZRAM is that it prevents extensive writes to your SD card, which will prolong the card’s failure. Depending on your persistence settings, MapDB will write very frequently.

I would instead suggest that you set up a small UPS with Network UPS Tools, enabling your OH server to do a proper shutdown when there’s a power outage. My UPS runs for about 10 minutes. This also prevents the possibility of your SD card being corrupted by the sudden power loss, which is really the bigger concern.