GitHub

get_follows = (edges.2 as [str]) where {
 edges = keys (bool) @ <[name, "Follows", free::(str)]>;
 name = given::(str);
};
 
with {
 <["Jim", "Follows", "Simon"]> <- {2012-05-17T14:29:12-07:00};
 <["Jim", "Follows", "Martin"]> <- {2012-07-12T12:15:02-07:00};
 <["Martin", "Follows", "Simon"]> <- {2011-01-02T23:11:11-07:00};
 <["Simon", "Follows", "Martin"]> <- {2023-09-28T11:04:28-07:00};
} test {
 get_follows(.name: "Jim") == ["Simon", "Martin"];
 get_follows(.name: "Martin") == ["Simon"];
 get_follows(.name: "Simon") == ["Martin"];
};

graph

This is the repository for the Orly (pronounced “Oh Really”) non-relational database. It’s meant to be fast and to scale for billions of users. Orly provides a single path to data and will eliminate our need for memcache due to its speed and high concurrency.

https://github.com/orlyatomics/orly

Orly features:

  • Points of View: This is our version of optimistic locking or isolation. In traditional databases, clients have to lock the entire database (or at least large swaths of it) before updating it to ensure data remains consistent. In Orly, clients make changes in their own private points of view, which are like small sandboxes. Changes in private points of view eventually propagate into shared points of view and eventually reach the global point of view, which is the whole database. Updates to private points of view don’t lock anything: Orly determines later whether, when, and how to reconcile changes from different points of view. We also encourage field calls rather than field changes (e.g., x += 1 is better than x = x + 1).
  • Time Travel: We use something called the Flux Capacitor to keep a history of changes made to the database and to resolve conflicts as they come into shared points of view and the global point of view. This permits us to perform consistent read for any point in time. Orly defines its “time line” by causality rather than clock time. Instead of manipulating timestamps, Orly records an ordering of events (e.g., update A affects update B, so A “happens before” B).)
  • Query Language: Orly has its own high-level, compiled, type-safe, functional language called Orlyscript. Orlyscript is not just a query language: You can write general-purpose programs in it complete with compile-time unit tests. Orly comes with a compiler that transforms Orlyscript into shared libraries (.so files on Linux), which Orly servers load as packages.
  • Native Data Structures

    • List
    primes = [2, 3, 5, 7, 11, 13, 17];
    
    • Set
    fruits = {"apple", "orange", "pear", "banana"};
    
    • Dictionary
    student_ids = {"Alice" : 100234, "Bob": 2394192, "Dave" : 231120};
    
    • Tuple
    one = <[1, 1.0, "one", "first"]>;
    

    Tuples are similar to lists in that they can both contain duplicate elements but tuples can contain elements of different types. The outer <> in <[]> signifies this notion augmented onto a list.

    • Object
    student = <{.id: 2031101, .first_name: "Eve", .address: "104 Market St. San Francisco CA"}>;
    

    Objects are similar to dictionaries in that the keys are unique, but the values can be of different types. The outer <> in <{}> signifies this notion augmented onto a dictionary.

    The brackets around tuple and object may look weird at first. But they stay consistent in that they add the ability to store multiple types onto list and dictionary. With that in mind, the syntax should make much more sense.

  • Scalability and Availability: While we eventually plan to develop a sharded Orly machine (and actively design so that we can build such a machine), our current single-node server with fail-over/replication can handle hundreds of thousands of transactions per second. We like to say that Orly will function on a “planetary scale”: Your data and computations will not only distribute across a data center, but also across many data centers across the globe. This means that no disaster short of nuking the planet fifty times over or colliding with a gigantic asteroid will destroy your data. (Even those might not be catastrophic: Maybe we’ll have data centers running Orly with your replicated data on the moon or Mars.)

Leave a Reply