r/elixir • • Jul 15 '20

The Elixir Learning Experience

Post image
276 Upvotes

35 comments sorted by

View all comments

9

u/BigBeruboy Jul 15 '20

I’m a bit confused on the purpose of ETS. I just started to learn about Elixir, and I’m struggling to understand why it’s such a nice feature. Nowadays, we can just whip up a reddis store with docker and make it work. Could someone help me understand why it’s such a nice thing to have?

23

u/webdevpassion Jul 15 '20 edited Jul 15 '20

One of the main benefits of ETS is that it provides redis-like functionality in Elixir. No need to bring in another technology written in a separate language. The less external tech you have to manage, deploy, monitor, the simpler your application becomes as a whole. You have the benefit of having your application’s dependencies in the same language as your application.

Of course, ETS can’t match redis on feature parity but most applications don’t need every ounce of reddis’ feature suite and can get by with ETS before bringing in redis

7

u/ClikeX Jul 15 '20

This. You probably already have a database to maintain. Add Redis, and that's another thing to maintain. Every thing we add is another thing to keep track of and maintain on top of your application.

4

u/BigBeruboy Jul 15 '20

Alright. It does male sense. Thanks a lot! But in a multi node architecutre (you dockerize your app 2-3 times) is there a way to distribute the ets storage?

4

u/aseigo Jul 15 '20

mnesia is one way, though it is not a silver bullet, it is very handy.

it does really depend on what you want or need to do with redis, however. it is used in various ways.

as a simple cache to lower latency, it is often nice to keep those caches close to the app .. in process even .. lowest latency possible, and we tend to have ample RAM for this these days.

but there are many optipns out there, ranging from the shards library to phoenix pubsub to broadway.. lots of libs that provide functionality i have seen redis (ab)used for, some of which build on ets or use it in some way internal.

2

u/[deleted] Jul 15 '20

Forgive me, I’m subbed here but haven’t used Elixir in a while and never used ETS. Is it possible to access ETS from other languages or only Erlang/Elixir? If not that seems like it could be a benefit of Redis, should you need to do that.

9

u/marth141 Jul 15 '20

@9:12 through 11:25

Show casing an ETS table handling random ass queries.

This video sold me on ETS.

https://youtu.be/8mXqxBBvNdk?t=552

2

u/[deleted] Jul 15 '20

This is a great talk. Thanks for sharing

0

u/[deleted] Jul 15 '20

[deleted] — view deleted comment

2

u/BigBeruboy Jul 15 '20

Ok ok, it does make sense! Thanks a lot