Giter VIP home page Giter VIP logo

olivia's Introduction

Olivia

Build Status Go Report Card

Olivia is essentially a distributed hash table that I built to test out some weird ideas I've had about Go and distributed programming that I've had.

What is Olivia

Olivia is essentially just a distributed hash table with added goodies. From early on, I wanted to use bloomfilters to enhance lookup speed between different remote nodes and I'm fairly happy with how that's turned out. Bloom filters allow us to prioritize which nodes we'll request keys from, rather than blindly sending out requests to all known nodes.

What Olivia could become

I'm still not 100% sure on the end vision. When I originally started out building this thing, I just wanted three things:

  • Distribution
  • Remote key lookups (consistency between each node has never been huge)
  • Key Expiration

As I build it, however, my desired are changing. I now want consistency between nodes, but I haven't yet decided how I'll go about it. Olivia was originally intended to be part of a distributed torrent tracker network, but it is no longer a worthwhile pursuit, as distributed hash tables (as a part of the Bittorrent network) are able to be edited (upon BEP acceptance).

Running an Olivia Node

Real quick and easy steps to run a node:

  1. git clone https://github.com/GrappigPanda/Olivia
  2. cd Olivia
  3. go get ./...
  4. go build
  5. ./Olivia

These 5 commands will get a base level node running, where the node runs, accepts commands, and will allow incoming connections from other Olivia nodes. To run a network of nodes, please see the config file and change a grand total of 3 variables.

An example workflow.

  $ nc 127.0.0.1 5454
  SET key1:value1,key2:value2,key3:value3
  :SAT key1:value1,key2:value2,key3:value3
  GET key2
  :GOT key2:value2

This is a really simple workflow, but it shows that setting keys/retrieving keys is simple.

Contact Maintainer

open an issue

tweet me

or email me

License

The MIT License (MIT)

Copyright (c) 2016 Ian Clark

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

olivia's People

Contributors

ianleeclark avatar mantyr avatar n10v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

olivia's Issues

Decide on DHT implementation

Right now I'm mostly familiar with the Chord implementation, but there are others which could potentially be better suited for the task. I'm going to use a todo list here, but whenever an implementation is decided to be not sufficient, I'll tick it off and post an accompanying reason.

  • Chord
  • Kademlia
  • Pastry
  • Tapestry

Improve RLE encoding

Right now it's really inefficient and isn't compressing nearly as much space as it ought to.

Add a config loader. Use Viper

There's a growing number of magic numbers used throughout the codebase, so it's better I start configuration now rather than later.

Allow key expiration

With the priority queue, it should be alot simpler than previously though. Depending on how the heartbeat event loop is built, this may be baked into it.

Implement hashing functions in C

The erlang interoperability should allow us to easily interface with C and ensure were using a fast implementation of fnv, murmur and Jenkins.

Implement an incoming connection handler.

There should be a thin layer that handles creating a new connection processor per incoming socket.

The Connection processor needs to be a FSM which has at least these states:
unauth
authenticated (able to process incoming commands)

There shouldn't be any actual command processing included in this, as that will be part of another issue.

Implement copy on write

Essentially with COW (copy on write) I can make the underlying map thread-safe and only have to update on each write. This'll help improve performance and it'll cut down on the number of locks necessary to only write/delet operations rather than all CRUD operations.

Heartbeat remote nodes

The heartbeat should trigger every x milliseconds. If 10 or more successive heartbeats fail, mark the node as timed out and replace the peer with another. Honestly not a fan of this magic number.

We can heartbeat additional nodes once a minute (or so), but this should be a configurable option.

This can either be before or after the previous issue, but it makes sense for this to be before (if you're me at this exact specific time, maybe not in the future).

Run length (de-)encoding for bloom filters

Right now we're sending a ton of data and there's a high likelihood of there being a lot of 0s in the data. RLE would help to cut down on the amount of data we're sending in.

Add an event loop

Esesntially the event loop will be the backbone of key expirations & sending heartbeat updates
to remote nodes.

Make the underlying map thread-safe

There's probably libraries for concurrent/atomic maps somewhere. If I want to keep with the entirely hand-written, then I can roll my own, I guess

Place backup peers in backup peer list

We need a way for nodes to discover each other so they never get segmented.

Moreover, once a peer has been discovered, it needs to be placed into a backup list in the peer list which can be later used to retrieve backup peers in the case of a peer dying.

There's a good chance I have a REQUEST peers implemented, and if I don't, that should be how it's done. Just return a comma delimited list of IP:PORT which can be parsed out.

Peers should then be tested to see if they're connectable. If not, set their status to disconnected.

Implement an LRU cache

This will mostly be used for the hashKey function in bloom.go, but it might serve useful in the future.

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.