sop

Scalable Objects Persistence


Project maintained by SharedCode Hosted on GitHub Pages — Theme by mattgraham

SOP: The Swarm Computing Storage Engine

An Army of Ants: Zero Supervision, Infinite Scale

In the world of distributed systems, we often build architectures that resemble a rigid military hierarchy. We have a “Master” node (the General) and “Worker” nodes (the Soldiers). The General issues commands, tracks every movement, and ensures no two soldiers bump into each other.

This works—until the General gets overwhelmed. As the army grows, the General becomes the bottleneck. The soldiers spend more time waiting for orders than doing work.

Scalable Objects Persistence (SOP) takes a different approach. It is designed not like a military hierarchy, but like a swarm of ants.

The Analogy: The Colony at Work

Imagine an army of ants foraging for food.

  1. Zero Supervision: There is no “General Ant” shouting orders to every individual. Each ant knows exactly what to do: find food, bring it home.
  2. Autonomous Execution: Each ant works independently. If one ant pauses, the others keep moving.
  3. Pheromone Coordination: They don’t communicate via long meetings. They leave simple, lightweight chemical signals (pheromones) to coordinate paths.
  4. Collective Success: Individually, they are small. Together, they move mountains.

SOP in the Cluster: The Technical Realization

SOP implements this “Swarm Computing” model to achieve linear scalability and remove the bottlenecks typical of Master/Slave database architectures.

1. Every Node is a Master (Zero Supervision)

In an SOP cluster, every application instance or microservice running the SOP library acts as its own Master. There is no central “SOP Server” that accepts data and writes it to disk.

2. Redis as Pheromones (Lightweight Coordination)

Ants don’t carry the food to the Queen to ask where to put it. They use pheromones to signal “this path is busy” or “food is here.”

SOP uses Redis exactly like pheromones.

When an SOP transaction wants to modify an item, it leaves a “scent” (a lightweight key) in Redis. Other transactions check for these scents. If the path is clear, they proceed immediately. This interaction is lightning fast (microseconds) and involves no heavy data transfer.

3. In-Flight Data Merging (No Bottlenecks)

What happens if two ants try to place food in the same storage chamber?

In traditional databases, the system locks the entire chamber (Table or Page Lock), forcing one ant to wait until the other is completely finished and has left the building.

SOP employs In-Flight Data Merging.

They only stop if they are fighting over the exact same crumb (the same Key), in which case the OOA ensures data integrity by asking one to retry.

The Result: Tremendous Throughput

Because there is no central supervisor to overwhelm, you can keep adding “ants” (nodes) to your cluster indefinitely.

The workers coordinate “in good faith” using lightweight signals, merging their work in-flight, and checking in data massively and in parallel.

This is Swarm Computing. This is SOP.

Examples

See the “Concurrent Transactions” examples in our language bindings for practical implementations of Swarm Computing:

Practical Tip: The “First Commit” Rule

To enable seamless concurrent merging on a newly created B-Tree, you must pre-seed the B-Tree with at least one item in a separate, initial transaction. This establishes the root node and structure, preventing race conditions that can occur when multiple transactions attempt to initialize an empty tree simultaneously.

Note: This requirement is simply to have at least one item in the tree. It can be a real application item or a dummy seed item.

Part 2: The Compute Swarm (Agents & Scripts)

While SOP provides the “Storage Swarm” (distributed, lock-free data persistence), our AI Framework introduces the “Compute Swarm”.

We have built a powerful framework where programming logic itself is distributed, autonomous, and network-native.

1. Scripts as Distributed DNA

In a traditional system, code is static and deployed to specific servers. In our Swarm, Scripts act as the genetic code of the operation.

2. Agents as Autonomous Workers

Agents in our framework are not just chatbots; they are autonomous compute units.

3. The Vision: Distributed Execution Helpers

We are moving towards a model where users can simply “release” a task into the swarm.

This transforms the system from a passive data store into an active, living Swarm Computer.