lazy write

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
piet66
Posts: 277
Joined: 04 Feb 2017 17:00

lazy write

Post by piet66 »

Hello,
can anybody please provide some information about the new lazy write method? I've not yet found anything. What's the meaning of the additional parameter (true, immediate) in saveObject?
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me(327) ZW0700 7.21.00 07.42/17367041 1025/257
Z-Way version v4.1.2 from 2023-10-18 03:34:26 +0300
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: lazy write

Post by PoltoS »

saveObject = function(name, object, immediate)

immediate can be:
0 or true to write right now
>0 to defer it to N seconds
undefined (missing) to use the default defer time of 5 minutes
piet66
Posts: 277
Joined: 04 Feb 2017 17:00

Re: lazy write

Post by piet66 »

That means, another application can read this data not before the defer time is over?

Is the file stored with the same Linux process as the module instance or with a different process?
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me(327) ZW0700 7.21.00 07.42/17367041 1025/257
Z-Way version v4.1.2 from 2023-10-18 03:34:26 +0300
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: lazy write

Post by PoltoS »

Correct. The data is not written to the filesystem before the defer time. This reduces write cycles and improved the SD card performance.

Of course the same pricess is doing save the data to the filesystem, just a bit later.
piet66
Posts: 277
Joined: 04 Feb 2017 17:00

Re: lazy write

Post by piet66 »

I'm sorry to be so insistent. But you will know that I'm using saveObject in my MxChartJS module. And of course I want to do that as little stressing as possible.
This reduces write cycles and improved the SD card performance.
This sentence I haven't understood. Why does it reduce the write cycles, if you only do a break before execution? This doesn't combine the various write accesses?
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me(327) ZW0700 7.21.00 07.42/17367041 1025/257
Z-Way version v4.1.2 from 2023-10-18 03:34:26 +0300
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: lazy write

Post by PoltoS »

We are keeping the object in memory instead of writing to the SD. After 5 minutes we will save it to the memory. So all intermediate saveObject will be skipped.
Post Reply