lazy loading for rocksdb backend (statefun)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

lazy loading for rocksdb backend (statefun)

Stephan Pelikan

Hi,

 

for development I used the memory backend. Now I switch to rocksdb backend and have some questions:

 

  1. Will all values (@Persisted) be loaded eagerly (on activation of the function’s scope) or is there some kind of lazy loading?
  2. If there is some kind of lazy loading:
    1. Does this apply to PersistedValue?

                                                    i.     Means will the value be loaded once I access the getter?

                                                   ii.     Will a previous value be loaded on setting a new value?

    1. In which way would this apply to PersistedTable?

                                                    i.     Will the keys be loaded eagerly or lazy?

                                                   ii.     Will the entire map be loaded on accessing the table…

                                                  iii.     …or will each value be loaded on accessing by key?

                                                  iv.     Will the entire map be loaded on accessing the keys but not the values or are the keys stored in a way which allows to load only the keys?

                                                   v.     Will the entire map be loaded on putting/updating one value by key?

 

I don’t use it yet, but what about PersistedAppendingBuffer? The existence of such a type suggests that there is some kind of lazy loading (at least to not load all data on writing).

 

I’m thankful for clarification about it 😊

 

Cheers,

Stephan

 

Reply | Threaded
Open this post in threaded view
|

Re: lazy loading for rocksdb backend (statefun)

Igal Shilman
Hello Stephan,

The values are loaded lazily, upon access. And this applies to both PersistedTable and PersistedValue.
For a PersistedTable in particular, calling get/set/remove will only affect the specific key, and calling entries() will fetch the entire map.

Cheers,
Igal.



On Sun, Feb 14, 2021 at 1:13 PM Stephan Pelikan <[hidden email]> wrote:

Hi,

 

for development I used the memory backend. Now I switch to rocksdb backend and have some questions:

 

  1. Will all values (@Persisted) be loaded eagerly (on activation of the function’s scope) or is there some kind of lazy loading?
  2. If there is some kind of lazy loading:
    1. Does this apply to PersistedValue?

                                                    i.     Means will the value be loaded once I access the getter?

                                                   ii.     Will a previous value be loaded on setting a new value?

    1. In which way would this apply to PersistedTable?

                                                    i.     Will the keys be loaded eagerly or lazy?

                                                   ii.     Will the entire map be loaded on accessing the table…

                                                  iii.     …or will each value be loaded on accessing by key?

                                                  iv.     Will the entire map be loaded on accessing the keys but not the values or are the keys stored in a way which allows to load only the keys?

                                                   v.     Will the entire map be loaded on putting/updating one value by key?

 

I don’t use it yet, but what about PersistedAppendingBuffer? The existence of such a type suggests that there is some kind of lazy loading (at least to not load all data on writing).

 

I’m thankful for clarification about it 😊

 

Cheers,

Stephan