Phew, I'm glad GitHub and Shopify's scale is still small.
Phew, I'm glad GitHub and Shopify's scale is still small.
I mean, every programmer who funnels through university understands map reduce, and that helps on multi-core threading up to system job running.
But there is a limit, usually in the persistence and caching layers. What you'll find is that those "large scale deployments" are going to have a -lot- of internal cache systems and I can pretty much guarantee that the services running those caches and persistence will not be written in ruby.
You can make anything* scale, but how many CPU cycles you need to burn to get the functionality you want is a matter for the finance department.
If you're running in a lossy business, you can bet that those CPU cycles will begin to cost more than developer velocity is worth, because servers are an eternal and ongoing cost.
On the flip side if you make more money than the infra+devs cost, then nobody is going to hound you for wasting 2x 3x the cost. Because "it's the cost of doing business" is easier to justify when you're cash positive.
So what? What's wrong with using software like redis for cache, for a very small (but important) part of your business? I bet java apps use redis as well, and redis isn't written in java. So?
Erlang/Elixir have built-in caches that respond in the matter of 30-150 nanoseconds.
Why would you need an external service for that? It's adding complexity -- and likely hosting costs.
Isn't it self-evident to you that adding Redis as a caching layer to your stack is a bandaid to a deeper problem?
What's the name of the concept and where in the typical stack does it fit? Is this https://blog.appsignal.com/2019/11/12/caching-with-elixir-an... or something else? Care to share a few link to docs/articles? Thanks.
There are libraries that combine Erlang/Elixir's caching mechanisms in an attempt to achieve the best performance for most scenarios[1] as well.
Technically, ETS is not perfect because it copies data from its mutable cache to the process that requests it. But it's still orders of magnitude faster than outsourcing that to Redis.
I read in http://erlang.org/doc/man/ets.html that "Each table is created by a process. When the process terminates, the table is automatically destroyed. Every table has access rights set at creation."
-> So, caching is local to each worker node/process? Do nodes/processes communicate between them to synchronize their respective caches, or is it local by design?
If local by design, that wouldn't exactly cover the use case of "Redis in front of an army of $other_language workers", correct? And I guess it's accepted as costing slightly more cache misses, but with the benefit of more decentralization / node independence / resiliency, right?
> If local by design, that wouldn't exactly cover the use case of "Redis in front of an army of $other_language workers", correct? And I guess it's accepted as costing slightly more cache misses, but with the benefit of more decentralization / node independence / resiliency, right?
Yes and yes.
Erlang/Elixir don't strive to make distributed caches. I wrote apps that have been scaled to 5 separate servers and each server has their own local cache (running inside the Erlang BEAM VM). Takes a little more time to warm the caches up on restarts but it has never been an issue so far.
The ETS tables ownership is trivial to hand out to another process if the owner dies (look for the "heir" option in ETS docs) but libraries like Cachex (linked at the bottom) and Ane (linked in my previous comment) wrap the ownership worries away from you.
What's left for you is just an uber-performant cache.
Do take a look at Cachex. It's hassle-free and just works.
> "Erlang/Elixir don't strive to make distributed caches. I've wrote apps that have been scaled to 5 separate servers and each server has their own cache. Takes a little more to warm the caches up on restarts but it has never been an issue so far."
Yeah that's what I figured, makes total sense. Got into exactly the same thinking designing a circuit breaker at work. Better to let individual nodes do their own circuit breaking rather than introduce state, the complexity savings largely exceed the small cost of a little extra time needed to circuit break.
We're also dependent on mysql, are you gonna implement that in Elixir as well? Redis is a great piece of software, and it's a real SHARED cache, so it could work for sessions or other small state management you sometimes want to remember for example. What you described won't work for that.
Sessions work quite fine in Elixir's local cache as well. :)
This seems to suggest otherwise https://hex.pm/packages/redix, Why is the redis client is so popular in Elixir world? For such a small community 3+ million downloads is huge.
It's no accident that there's even a library that emulates OOP patterns in Elixir.
You're quite right: people using it as a mere cache don't get most of its benefits.
It’s not a “problem”, but if you’re going to talk about large companies scaling something you need to understand that they’re likely scaling it in spite of limitations.
Largely, some systems don’t scale too well (latency on network accessible cache, throughput in persistence layers such as databases) so a lot of application layers will lean on those things heavily and they are exclusively written in relatively “faster” languages.
I wish this were true. There is a high degree of variability between skillsets from different American universities, even in my state of Washington.
Other than that, I agree whole heartedly.
Phew, good thing they can afford to burn a lot of cash for hosting.
>...a web startup like ours doesn’t need any outside money to succeed. I know this because we haven’t taken a single dime from investors. We bootstrapped the company on a few thousand dollars and became profitable the day we opened to the public and started charging for subscriptions.
Tom Preston-Werner in 2008. I guess the thing is not how much the hosting costs in absolute terms but how much it costs relative to what customers are prepared to pay for the service.
My point is, yes, you are right -- but there's a lot of conservatism involved once the business gets to a certain size. Nobody cares about improving anything from then on (which usually leads to the now-giant to start steadily losing relevance; GitHub is quite far from that but we all remember Microsoft, right?).
Edit: getting downvoted by people that don't work at Shopify.