Giter VIP home page Giter VIP logo

spinoza's Introduction

spinoza

A model of the Calvin distributed database. The main purpose of this model is expository, rather than analysis for correctness or performance. All concurrency and distribution is modeled in a single-threaded process with in-memory data tables, which makes it easier to understand what is happening.

Spinoza, like Calvin, was a philosopher who dealt in determinism.

Calvin is developed by the Yale Databases group; the open-source releases are at https://github.com/yaledb.

Structure

The model of the underlying computer and network system is in lib/spinoza/system.

The Calvin model, implemented on the system models, is in lib/spinoza/calvin. Other distributed transaction models could also be implemented on this layer.

The transaction class, in lib/spinoza/transaction.rb, is mostly abstracted from these layers. It is very simplistic, intended to illustrate Calvin's replication and consistency characteristics.

Running

You will need ruby 2.0 or later, from http://ruby-lang.org, and the gems listed in the gemspec:

sequel
sqlite3
rbtree

You can also gem install spinoza, but it may not be up to date.

To run the unit tests:

rake test

Examples TBD.

Observing

One benefit of modeling concurrency in a single thread is being able to see what is going on at every node at every moment in time. In fact, Spinoza keeps a history of all "events". (Events are how we model the passage of time and the actions that occur at a point in time.) As noted in test/test-scheduler.rb, you can use this to make assertions about what occurred, when, and where:

pp @timeline.history.select {|time, event| event.action != :step_epoch}

(The :step_epoch events are frequent and not usually very interesting.) The hostory is stored in a red-black tree for easy access by time interval.

References

To do

  • The performance and error modeling should optionally be statistical, with variation using some distribution.

  • Model IO latency and compute time, in addition to currently modeled network latency.

  • Log#time_replicated should be a function of the reading node and depend on the link characteristics between that node and the writing node.

  • Transactions, to be more realistic, should have dataflow dependencies among operations. (But only for non-key values, because Calvin splits dependent transactions.)

  • Transactions also need conditionals, or, at least, conditional abort, which is needed to support the splitting mentioned above.

  • For comparison, implement a 2-phase commit transaction processor on top of the Spinoza::System classes.

  • Output spacetime diagrams using graphviz.

  • See also 'TODO' in code.

Contact

Joel VanderWerf, [email protected], @JoelVanderWerf.

License and Copyright

Copyright (c) 2014, Joel VanderWerf

License for this project is BSD. See the COPYING file for the standard BSD license.

spinoza's People

Contributors

vjoel avatar

Stargazers

Arjun Sunil Kumar avatar Johnneylee Jack Rollins avatar Jacob Lerche avatar Wei Cao avatar Harish M avatar  avatar John S. Dvorak avatar

Watchers

 avatar Johnneylee Jack Rollins avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.