Behaviours: gen_server.
the local view of the cluster's ring configuration
Numerous processes concurrently read and access the ring in a
variety of time sensitive code paths. To make this efficient,
riak_core uses mochiglobal which exploits the Erlang constant
pool to provide constant-time access to the ring without needing
to copy data into individual process heaps.
However, updating a mochiglobal value is very slow, and becomes slower
the larger the item being stored. With large rings, the delay can
become too long during periods of high ring churn, where hundreds of
ring events are being triggered a second.
As of Riak 1.4, riak_core uses a hybrid approach to solve this
problem. When a ring is first written, it is written to a shared ETS
table. If no ring events have occurred for 90 seconds, the ring is
then promoted to mochiglobal. This provides fast updates during
periods of ring churn, while eventually providing very fast reads
after the ring stabilizes. The downside is that reading from the ETS
table before promotion is slower than mochiglobal, and requires
copying the ring into individual process heaps.
To alleviate the slow down while in the ETS phase, riak_core
exploits the fact that most time sensitive operations access the ring
in order to read only a subset of its data: bucket properties and
partition ownership. Therefore, these pieces of information are
extracted from the ring and stored in the ETS table as well to
minimize copying overhead. Furthermore, the partition ownership
information (represented by the chash structure) is converted
into a binary chashbin structure before being stored in the
ETS table. This chashbin structure is fast to copy between processes
due to off-heap binary sharing. Furthermore, this structure provides a
secondary benefit of being much faster than the traditional chash
structure for normal operations.
chashbin structure do so using those methods rather than
retrieving the ring via get_my_ring/0 or get_raw_ring/0.
| cleanup_ets/1 | |
| do_write_ringfile/1 | |
| find_latest_ringfile/0 | |
| force_update/0 | Exposed for support/debug purposes. |
| get_bucket_meta/1 | Return metadata for the given bucket. |
| get_chash_bin/0 | Return the chashbin generated from the current ring. |
| get_my_ring/0 | |
| get_raw_ring/0 | |
| get_raw_ring_chashbin/0 | |
| get_ring_id/0 | |
| handle_call/3 | |
| handle_cast/2 | |
| handle_info/2 | |
| is_stable_ring/0 | |
| prune_ringfiles/0 | |
| read_ringfile/1 | |
| refresh_my_ring/0 | |
| refresh_ring/2 | |
| ring_trans/2 | |
| set_cluster_name/1 | |
| set_my_ring/1 | |
| set_ring_global/1 | |
| setup_ets/1 | |
| start_link/0 | |
| start_link/1 | |
| write_ringfile/0 |
cleanup_ets(X1) -> any()
do_write_ringfile(Ring) -> any()
find_latest_ringfile() -> string()
force_update() -> any()
Exposed for support/debug purposes. Forces the node to change its ring in a manner that will trigger reconciliation on gossip.
get_bucket_meta(Bucket) -> any()
Return metadata for the given bucket. If a bucket for the non-default type is provided {error, no_type} is returned when the type does not exist
get_chash_bin() -> any()
Return the chashbin generated from the current ring
get_my_ring() -> {ok, riak_core_ring:riak_core_ring()} | {error, Reason}
get_raw_ring() -> any()
get_raw_ring_chashbin() -> any()
get_ring_id() -> any()
handle_call(X1, From, State) -> any()
handle_cast(X1, State) -> any()
handle_info(Info, State) -> any()
is_stable_ring() -> any()
prune_ringfiles() -> ok | {error, Reason}
read_ringfile(RingFile::string()) -> riak_core_ring:riak_core_ring() | {error, any()}
refresh_my_ring() -> ok
refresh_ring(Node, ClusterName) -> any()
ring_trans(Fun, Args) -> any()
set_cluster_name(Name) -> any()
set_my_ring(Ring::riak_core_ring:riak_core_ring()) -> ok
set_ring_global(Ring) -> any()
setup_ets(Mode) -> any()
start_link() -> any()
start_link(X1) -> any()
write_ringfile() -> ok
Generated by EDoc