Estimating flash write io of SQLite operations

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Estimating flash write io of SQLite operations

Lutz.Reinhardt
Hi Sqlite Users,

The goal is that an eMMC flash chip survives 15 years. And as we all know flash memory only supports a limited amount writes per cell before it fails. So if I get data to store from the user I would like to estimate before putting it into the database how much pages SQLite is going to write/modify to the flash. Is there any API, which can provide me such an estimation?

I will also use a VFS shim to get the real number of written bytes afterwards.

BR,
Lutz
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Estimating flash write io of SQLite operations

Richard Hipp-3
On 3/28/18, [hidden email] <[hidden email]> wrote:

> Hi Sqlite Users,
>
> The goal is that an eMMC flash chip survives 15 years. And as we all know
> flash memory only supports a limited amount writes per cell before it fails.
> So if I get data to store from the user I would like to estimate before
> putting it into the database how much pages SQLite is going to write/modify
> to the flash. Is there any API, which can provide me such an estimation?
>
> I will also use a VFS shim to get the real number of written bytes
> afterwards.

There is no such API that I can think of.  I think you will need to
write a custom VFS shim to get that information.  I suspect
https://www.sqlite.org/src/file/ext/misc/vfsstat.c is sufficient for
this task.

The best way I know of to minimize flash wear is to switch to the F2FS
filesystem and use PRAGMA journal_mode=DELETE.  If you cannot use the
F2FS filesystem, then PRAGMA journal_mode=WAL with PRAGMA
synchronous=NORMAL is probably your best bet.

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Estimating flash write io of SQLite operations

Lutz.Reinhardt
> > The goal is that an eMMC flash chip survives 15 years. And as we all
> > know flash memory only supports a limited amount writes per cell before it
> fails.
> > So if I get data to store from the user I would like to estimate
> > before putting it into the database how much pages SQLite is going to
> > write/modify to the flash. Is there any API, which can provide me such an
> estimation?
> >
> > I will also use a VFS shim to get the real number of written bytes
> > afterwards.
>
> There is no such API that I can think of.  I think you will need to write a
> custom VFS shim to get that information.  I suspect
> https://www.sqlite.org/src/file/ext/misc/vfsstat.c is sufficient for this task.
>
> The best way I know of to minimize flash wear is to switch to the F2FS
> filesystem and use PRAGMA journal_mode=DELETE.  If you cannot use the
> F2FS filesystem, then PRAGMA journal_mode=WAL with PRAGMA
> synchronous=NORMAL is probably your best bet.

Thank you. I will try that.

BR,
Lutz
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users