basho / basho_docs

Basho Products Documentation
http://docs.basho.com
Other
169 stars 191 forks source link

What does "max_memory" actually do? #1426

Closed lukebakken closed 9 years ago

lukebakken commented 9 years ago

http://docs.basho.com/riak/latest/ops/advanced/backends/memory/

We should document the following:

%% @private
%% @doc Dump some entries if the max memory size has
%% been breached.
trim_data_table(MaxMemory, UsedMemory, _, _, _, Freed) when
      (UsedMemory - Freed) =< MaxMemory ->
    Freed;
trim_data_table(MaxMemory, UsedMemory, DataRef, TimeRef, IndexRef, Freed) ->
    %% Delete the oldest object
    OldestSize = delete_oldest(DataRef, TimeRef, IndexRef),
    trim_data_table(MaxMemory,
                    UsedMemory,
                    DataRef,
                    TimeRef,
                    IndexRef,
                    Freed + OldestSize).
lucperkins commented 9 years ago

@lukebakken So, I messed up and didn't merge the 2.0+-specific version of that doc to master. The more up-to-date version of that doc can be found here:

https://github.com/basho/basho_docs/blob/2.0.0/source/languages/en/riak/ops/advanced/backends/memory.md

Could you have a look at that and let me know if this issue still applies? Needless to say, I will update that doc.

lukebakken commented 9 years ago

Yep, it still applies. max_memory will discard objects, oldest first, when the threshold is met.