You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-16Lines changed: 33 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,9 @@
5
5
6
6
ETS tables on steroids!
7
7
8
-
[Shards](https://github.com/cabol/shards) is an **Erlang/Elixir** library/tool compatible with the ETS API, that implements [Sharding/Partitioning](https://en.wikipedia.org/wiki/Partition_(database)) support on top of ETS totally transparent and out-of-box. **Shards** might be probably the **simplest** option to scale-out ETS tables.
8
+
[Shards](https://github.com/cabol/shards) is an **Erlang/Elixir** library/tool compatible with the ETS API,
9
+
that implements [Sharding/Partitioning](https://en.wikipedia.org/wiki/Partition_(database)) support on top of
10
+
ETS totally transparent and out-of-box. **Shards** might be probably the **simplest** option to scale-out ETS tables.
9
11
10
12
[Additional documentation on cabol.github.io](http://cabol.github.io/posts/2016/04/14/sharding-support-for-ets.html).
11
13
@@ -15,8 +17,8 @@ ETS tables on steroids!
15
17
Why we might need **Sharding** on ETS tables? Well, the main reason is to scale-out ETS tables
16
18
(linear scalability), and support high levels of concurrency without write-locks issues, which
17
19
most of the cases might cause significant performance degradation. Therefore, one of the most
18
-
common and proven strategies to deal with these problems is [Sharding/Partitioning](https://en.wikipedia.org/wiki/Partition_(database)) – the principle is pretty similar
19
-
to [DHTs](https://en.wikipedia.org/wiki/Distributed_hash_table).
20
+
common and proven strategies to deal with these problems is [Sharding/Partitioning](https://en.wikipedia.org/wiki/Partition_(database))
21
+
– the principle is pretty similar to [DHTs](https://en.wikipedia.org/wiki/Distributed_hash_table).
20
22
21
23
Here is where **Shards** comes in. **Shards** makes extremely easy achieve all this, with **zero** effort.
22
24
It provides an API compatible with [ETS](http://erlang.org/doc/man/ets.html) – with few exceptions.
@@ -39,20 +41,35 @@ Start an Erlang console with `shards` running:
39
41
Once into the Erlang console:
40
42
41
43
```erlang
42
-
% let's create a table, such as you would create it with ETS
43
-
>shards:new(mytab1, [], 4).
44
+
% let's create a table, such as you would create it with ETS, with 4 shards
45
+
>shards:new(mytab1, [{n_shards, 4}]).
44
46
{mytab1,{shards_local,set,4}}
45
47
```
46
48
47
-
As you can see, the `shards:new/2,3` function returns a tuple of two elements: `{mytab1,{shards_local,set,4}}`.
48
-
The first element is the name of the created table (`mytab1`), and the second one is the
0 commit comments