Live data from Hacker News

Write libraries instead of services, where possible

catern.com

151–160 of 328 posts

Re: Write libraries instead of services, where possible

#151

Phoenix is practically built with this idea in mind. My startup is built out of a single phoenix monolith. Only external dependency is postgres. Despite this, I've managed to completely avoid all the typical scaling issues of a monolith. Need a service or background worker? I juts make a Genserver or Oban worker and mount it in the supervision tree. The Beam takes care of maintaining the process, pubsub to said servi…

BEAM will automatically distribute processes across a cluster, right?

not automatically but its pretty easy to configure in your supervision tree file. I don't know the details because whatever happens by default has taken care of our needs so far.

IT does automatically distribute processes across all the cores on a cpu though.

Re: Write libraries instead of services, where possible

#152

Phoenix is practically built with this idea in mind. My startup is built out of a single phoenix monolith. Only external dependency is postgres. Despite this, I've managed to completely avoid all the typical scaling issues of a monolith. Need a service or background worker? I juts make a Genserver or Oban worker and mount it in the supervision tree. The Beam takes care of maintaining the process, pubsub to said servi…

BEAM will automatically distribute processes across a cluster, right?

No, typically you register a node and instruct it on what processes to run. But there are libraries to help instrument this kind of behavior.

For elixir:

- https://github.com/derekkraan/horde

- https://github.com/bitwalker/swarm

Re: Write libraries instead of services, where possible

#153
post #104

Earlier quoted context omitted.

You're right. The fact that people can make outsize rewards from subscription services are the reason that even small single use tools are now 'services'. I have a piece of software that removes the background from my video feed. It's a subscription, and it regularly phones home. I have a piece of software that lets me visually combine, rotate and reorder pdfs. It's a subscription. Even the simplest things, like a 't…

> Even the simplest things, like a 'torch' are ad-supported on android these days. This has a built-in feature on every smartphone for years now. These apps are a scam.

I guess it was a mere rhetorical artifice to mean "if not useless, of very scarse added value".

Re: Write libraries instead of services, where possible

#155
post #149

Phoenix is practically built with this idea in mind. My startup is built out of a single phoenix monolith. Only external dependency is postgres. Despite this, I've managed to completely avoid all the typical scaling issues of a monolith. Need a service or background worker? I juts make a Genserver or Oban worker and mount it in the supervision tree. The Beam takes care of maintaining the process, pubsub to said servi…

this sounds really neat and I'm going to go read about it! I also wanted to call out that this ~sentence has just... a bunch of things that seem like jargon/names within the community? As an outsider, I have no idea what they mean: > make a Genserver or Oban worker and mount it in the supervision tree. The Beam takes care of maintaining the process it sounds very sci-fi :)

They do sound very sci-fi. I would say it made me more or less inclined to dig a little deeper myself hahahaha.

Genservers are an abstraction encapsulating the typical request/response lifecycle of what we would consider a "server", but applied to a BEAM-specific process. Like "general server".

Oban allows for job processing, instrumented much like you would any other process in the BEAM. This is an external library while genserver is built in.

Re: Write libraries instead of services, where possible

#156

Earlier quoted context omitted.

I think you’re reading too far. The comment doesn’t imply that everything it’s about money. It’s only a question about monetizing a library.

What I was alluding to is that one of the first comments on this thread was "how do I make money out of this?" That indicates the priorities of the commenter, if nothing else.

All aspects of life in the US seem to be increasingly money focused, driven, or dictated by. It's not just tech but wherever there is more money to be had, there is more focus on money.

At some point, I wonder if our social and economic system becomes a close enough proxy to darwinistic survival of the fittest through capital ownership that a large enough portion of the population realize they would do better outside this construct rather than inside our societies and will begin to reject the system at large.

Right now we are able to provide stable food, housing, and ERs can't refuse people for medical care but stable housing is in the downturn and Healthcare costs that lead to bankruptcy conditions are on the rise. I feel like we're really testing how low many will go before they reject the system at hand and at what point is that number of people large enough to be critical to the existing system's stability.

At some point the effort for comfortable success may become so high people just abandon it entirely.

Re: Write libraries instead of services, where possible

#157
post #149

Phoenix is practically built with this idea in mind. My startup is built out of a single phoenix monolith. Only external dependency is postgres. Despite this, I've managed to completely avoid all the typical scaling issues of a monolith. Need a service or background worker? I juts make a Genserver or Oban worker and mount it in the supervision tree. The Beam takes care of maintaining the process, pubsub to said servi…

this sounds really neat and I'm going to go read about it! I also wanted to call out that this ~sentence has just... a bunch of things that seem like jargon/names within the community? As an outsider, I have no idea what they mean: > make a Genserver or Oban worker and mount it in the supervision tree. The Beam takes care of maintaining the process it sounds very sci-fi :)

sorry! so I'll clarify

Elixir inherits a library called OTP from erlang which is a set of primitives for building massively concurrent systems.

A Genserver is sort of like a Base Class for a object that runs as an independant process that plugs into OTP. By inheriting/implementing the Genserver behavior, you create an independant process that can be mounted in an OTP supervision tree which runs at the top of your application and monitors everything below it. Out of the box, that means your process can be sent messages by other processes and can send messages itself. If a crash happens, the supervisor will kill it, resurrect it and redirect messages to the new process.

Creating a Genserver is as easy as adding an annotation and implementing a few callbacks.

Genservers are the base on which a lot of other systems build on. Oban, a job worker essentially builds on Genserver to use a postgres table as a job processor. Since its just a Genserver with some added behavior, adding a background worker is as simple as adding a file that inherits from Oban and specifying how many workers for it should be allocated in a config file. The result is that adding a background worker is about as much work for me as adding a controller. No additional work for devops either.

And yes, it is very sci fi. Honestly I'm shocked elixir isn't more widespread. there's very little hype behind it but the engineering is pretty solid. Every scaling bottleneck we've had so far has been in the database (only because we particularly make heavy use of stored procedures)

Re: Write libraries instead of services, where possible

#158
post #105
post #65

I have a hard disagree here. Though, I suspect it is a matter of what your code is doing. First, my objection, though. Pushing this "to the users" is in no way easier to support. It is easier to abandon, but support is a different thing. You will have support contacts. And, due to the distributed nature of the deployment, you will have a much harder time isolating your code from the environment it is in. With a servi…

You have a disagreement. You don't have a disagree.

Take ~6min to watch Stephen Fry Kinetic Typography - Language. It is my favorite take on changes in English and addresses verbing of nouns directly.

https://www.youtube.com/watch?v=J7E-aoXLZGY

Re: Write libraries instead of services, where possible

#160

Phoenix is practically built with this idea in mind. My startup is built out of a single phoenix monolith. Only external dependency is postgres. Despite this, I've managed to completely avoid all the typical scaling issues of a monolith. Need a service or background worker? I juts make a Genserver or Oban worker and mount it in the supervision tree. The Beam takes care of maintaining the process, pubsub to said servi…

Anyone like me first hearing about Phoenix and had trouble finding it, it's an Elixir framework: https://www.phoenixframework.org/
Post reply on HN