r/programming • • 11h ago

Fractal Cluster

https://hasen.dev/fractal-cluster/
7 Upvotes

9 comments sorted by

1

u/Character_Respect533 10h ago

Is there's code snippet for this? Or is it just a general concept?

1

u/hasen-judi 10h ago

I am developing a framework based on this concept, but this page is not about the framework, it's about the concept itself.

The cluster shard visualization is based on the gui I have right now for visualizing the local cluster.

6

u/karma_happens_next 8h ago

Ive been doing a lot of infrastructure stuff this last year and just have to say idealistically this sounds great, but practically it will hit a number of walls. I know more than the average bear but am not perfect, so please take these as strong opinions to look into.

Here are a couple things to think about:

  1. running message queues/jobs on API servers is typically not a great idea at scale, especially if your jobs are any amount of cpu intensive/long running tasks. You typically want to keep your API servers as lean as possible to decrease p50/95/99s.
  2. What happens is your DB grows in size faster than your nodes? Do you then have a bunch of nodes primarily mostly running DB? Depending on your DB choice (i dont know how all of them work), does rebalancing need to happen across your shards? What if one set of data is extremely hot / how does that balance across the shards? Honestly there are a lot of DB related questions about the type of design you propose, but im going to leave at that
  3. "Orchestration isn't a separate control plane — it's compiled into the program. Copy one binary to another VPS, point it at a peer, and watch the cluster absorb it." So....no orchestration? As a developer, i dont want to manually have to do anything for this. I dont want to have to track that the cpu level is getting too high across the deployment to manually do this. I dont want to manually track if one node becomes unhealthy / replace it....etc
  4. Why in the F would you not want to use a CDN? The additional load/bandwidth per server as well as increased latency are stupid tradeoffs so that you can run a single replicable contained node in this way IMO.
  5. My evolutionary biologist part wants a quick rant to close this out. There is a reason eukaryotes have multiple distinct functioning parts that work together for the expression of a whole. They specialize and they adapt in/with their environment to do their job most effectively. This enables things like say the stomach to be the size it is relative to the whole body based on the digestive needs of the organism. This gives capacity of scaling independent parts based on the needs of the organism.

1

u/hasen-judi 2h ago

This can only be proven out by running a service on top of this architecture at scale in real life.

There's absolutely no question in my mind that once we do that, we'll discover some issues, and we'll adjust the design based on the feedback. (Feedback from the Information we gather , not from users)

One of the issues is node specialization. To borrow a biological analogy, all the cells in the body are based on the same DNA, but they specialize by activating different parts of it more or less. A similar concept can be applied here, where several nodes can give different weights to what they run. You could have nodes that mostly just execute jobs and don't really respond to client requests.

I don't know that this will actually be an issue until we do run it and discover that it is, in fact, an issue. If that happens, the adjustment will be pretty small and easy to apply. 

The database is non-relational, so I don't know how much of what you know about them would apply here. In theory, the data should be fanned out about equally across shards, and shards are also fanned out equally across nodes. If you have some hot shards, they will be available in different nodes, so in theory, there should never be an extreme amount of pressure on any one node.

2

u/karma_happens_next 2h ago

"This can only be proven out by running a service on top of this architecture at scale in real life." Im a scientist all for experimentation and deeply in support of people pushing boundaries and going against conventions. Go for it.

Not claiming to be right here nor that I know all the implications.

That said, however, the statement of not being sure there will be an issue and if there is, it will be a pretty small and easy fix to apply is extremely indicative of Dunning Kruger effect. I dont mean to discourage curiosity, experimentation, or innovation, so im just going to strongly encourage you to do deep research exploring these ideas with AI before building. Not just looking for validation, but asking where things could break and what problems might happen. Asking what benefits this brings or could bring relative to current implementations.

This does not replace real world building/testing/scaling/experimenting, but it will likely refine the concept, support better planning of architecture, and/or possibly point you to the tools that already exist to serve the needs you are looking to serve.

1

u/hasen-judi 2m ago

Yea bro thanks for your input

2

u/paraffin 6h ago

Yeah. The “scalable” in scare quotes on the page is questionable.

But maybe this framework could serve the needs of app devs who need the basic functionality - APIs, queues, workers, databases, etc., and could use some degree of redundancy, but don’t need to execute heavy workloads for large numbers of clients.

There’s a lot of good use cases for low-volume applications which are otherwise going to be monoliths sitting on a SQLite anyway.

The real sticky wicket I see is upgrades and maintenance. If the whole app state and stack is one binary running in a swarm, you need to be very careful about upgrading both the framework and the application.

2

u/LunarWizard 7h ago

This reminds me a lot of Microsoft's Project "Orleans."

1

u/radarsat1 3h ago

I like this. I think it's its own thing, but the concept reminds me of CouchApps. Maybe an interesting place to look for some inspiration.