We have moved at community.getvera.com

Author Topic: Persistence and restoreOnStartup  (Read 2331 times)

Offline torpex77

  • Sr. Newbie
  • *
  • Posts: 46
  • Karma: +4/-1
Persistence and restoreOnStartup
« on: October 22, 2015, 01:52:37 pm »
I finally got some time to spend on this and my OpenHab configuration is proceeding nicely.  I've got items created for all the things I care about, and am getting ready to start in on moving my rules.

I did have general question, though, regarding configuring persistence.

Is is necessary and/or best practice to enable restoreOnStartup for the MiOS items, or will the binding automatically get and update all of the ones I have configured when it starts?

Any other tips for using persistence with the MiOS binding?

I'm going to use both MySQL and rrd4j for persistence, with MySQL being the default and only using rrd4j for the things I want to chart and need to persist once a minute. 

Thanks,

Doug

 

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Persistence and restoreOnStartup
« Reply #1 on: October 23, 2015, 07:45:36 am »
In my config I persist everything, but also author my Rules to handle the UnDef values they're sometimes presented.

Upon binding restart, the MiOS binding will reload all the data from Vera, but there are still cases where restoreOnStartup will give you an extra safety net. 

Things like editing an item file, without restarting, benefit from that safety net.

I use RRD as my primary persistence so not all data types are persisted.  At some point I'll cutover to th Key-value store (no historic data) to get those handled correctly.

One caution is that persistence stores need IO, and not all small form factor boards have fast IO... So sometimes they can be slow.  In my case I have the eMMC module on my Odroid C1'so it's not an issue, but using MicroSD cards can be a problem if you're persisting a lot,of Items.

Offline torpex77

  • Sr. Newbie
  • *
  • Posts: 46
  • Karma: +4/-1
Re: Persistence and restoreOnStartup
« Reply #2 on: October 23, 2015, 12:13:20 pm »
In my config I persist everything, but also author my Rules to handle the UnDef values they're sometimes presented.

Ok.  That sounds like a plan.  I may also look at using mapdb for just for the restore-on-startup stuff.

I've got an old laptop, dual core CPU with 4 G RAM and an SSD, to run OpenHab on so I think performance should be OK even with MySQL. 

Any worries about race conditions between restore-on-startup and the MiOS binding reload of values?  For example, could the restore-on-startup overlay the actual current value from the Vera?

Thanks,

Doug



Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Persistence and restoreOnStartup
« Reply #3 on: October 24, 2015, 01:28:37 pm »
I've got an old laptop, dual core CPU with 4 G RAM and an SSD, to run OpenHab on so I think performance should be OK even with MySQL. 

Probably enough to run several instances ;).  I run MQTT and a few other things on mine, and there's still room left over.

Quote
Any worries about race conditions between restore-on-startup and the MiOS binding reload of values?  For example, could the restore-on-startup overlay the actual current value from the Vera?

I haven't noticed any, but then again I haven't looked too close at the startup sequence lately... I run in DEBUG logging permanently (part of why you want fast disks) so I can always look if i need to.

I also just bought an external USB/mSATA SSD drive for long term data retention (energy monitoring).  This drive is tiny, even with its enclosure, so I'll offline stuff there eventually.

Offline torpex77

  • Sr. Newbie
  • *
  • Posts: 46
  • Karma: +4/-1
Re: Persistence and restoreOnStartup
« Reply #4 on: October 25, 2015, 09:32:32 pm »
Probably enough to run several instances ;).  I run MQTT and a few other things on mine, and there's still room left over.

MQTT is on my list of things to do, but I'm not sure when I actually get to it.  So many projects...

I haven't noticed any, but then again I haven't looked too close at the startup sequence lately... I run in DEBUG logging permanently (part of why you want fast disks) so I can always look if i need to.

OK.  I'll put that one in the "don't worry about it" pile.

Thanks,

Doug