by banashark · 3y ago · 0 comments
This is usually things around either ETS/mnesia for state storage or doing hot-releases, both of which I find most people in the community recommend _against_.
A few examples:
- Server-wide state - Persistable data - Background Jobs
Having worked in a heavy Erlang codebase and enjoyed some of the features of it, but realized some of the shortcomings where when reliability is a primary concern (medical/healthcare), a lot of the advice changes.
Though I haven't written any F# in a while, I was always curious to see how F# + https://learn.microsoft.com/en-us/dotnet/orleans/overview (virtual actors) would feel comparatively.
Specifically, hot loading allows for tremendous agility in rolling out code: for better and worse. There's sharp edges, but it's worth it IMHO (of course, it should be noted that AFAIK, hot loading is either unused or very rarely used at WhatsApp now. I believe they now use fairly conventional rollouts where new instances are started with the new code, load balancers shift the load and old instances are shut down eventually... back in my day, we didn't have load balancers or easy access to spare machines to rotate through, etc)
Mnesia has lots of sharp edges too, but if you are willing to learn them as you grow, and maybe do a bit of work here and there, disc_copies and ram_copies tables scale pretty good (afaik, we only used disc_only_copies for the schema table, and that's a small table, so it works; I don't think that table type works well with large tables). And having data and application colocated makes a lot of things pretty nice. IMHO, if you are doing the volume of data and accesses we were doing with any other database, you'd need in house engineering on the database as well, so I don't see it as a strong negative that it's needed for mnesia. If you have a smaller need, maybe it works out of the box. IMHO, mnesia works best with stable nodes and stable network though: the original use case was for two nodes in the same chassis, and the farther you stray from that, the more work you may have to do. But we had replication setup between Reston, VA and Dallas, TX and it worked fine as long as the backbone between the two wasn't being extra flakey.
Again, I think post-acquisition, mnesia was phased out, but FB doesn't value stability of nodes or networks.
From the first slide in the linked article, I would almost never use Erlang to store data. I'm always going to reach for Postgres there unless I've got some very specific use case.
I do think having most everything else "under the same roof" is nice for a smaller company that doesn't want to run a whole bunch of different services, though. Having an internal cron thing, and an internal job thing are probably fine for a lot of people getting something off the ground and easier to deal with than having something external to deal with. I think in particular this is often nice when trying to replicate the production environment on both a staging and local development system. If the infrastructure is complicated, that's harder to do. It's nice to be running substantially similar systems everywhere.
I'm not 100% sold that it's that big a win compared to having more libraries and such available with, say, Rails or PHP or Python or something. But it's definitely nice to have.