"helping you remove your bottlenecks
one process at a time..."
by @holsee
State
<proc>
State
<proc:0>
State
<proc:1>
<proc:0>
Next
State
<proc>
kv_store
The system is decomposed into lots of processes,
concurrency win!
...but they are all waiting to be served by our kv_store
R
R
R
R
W
W
W
R
W
Readers
Writers
Processes
.oO( uh oh )
Before our message ( ) gets processed we must wait until the other messages that arrived first have been processed.
kv_store
mailbox
ETS is a module that provides access to a bunch of Erlang BIFs that give us an in memory store for Erlang Terms!
These provide the ability to store very large quantities of data in an Erlang runtime system!
Providing constant access time to the data.
O(log n) for ordered sets & bags.
this will be useful for our key!
Option =
Type |
Access |
named_table |
{keypos, Pos} |
{heir, Pid :: pid(), HeirData} |
{heir, none} |
Tweaks
Type = set | ordered_set | bag | ordered_bag
Access = public | protected | private
Tweaks =
{write_concurrency, boolean()} |
{read_concurrency, boolean()} |
compressed
Tweaks =
{write_concurrency, boolean()} |
{read_concurrency, boolean()}
Good for bursts of READS and WRITES!
ETS
<mod>
kv_store
Now when our readers and our writers invoke our module kv_store they will bypass any single process mailbox and have direct access to the ETS store
R
R
R
R
W
W
W
W
R
I will show the ETS based Key Value store at the end
(when I write it at the end)!