Giter Site home page Giter Site logo

brhinescot / fabrictableservice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reubenbond/fabrictableservice

0.0 2.0 0.0 86 KB

Distributed database on Service Fabric which uses ESENT as the storage engine

License: MIT License

C# 94.76% PowerShell 5.24%

fabrictableservice's Introduction

#Service Fabric Table Service An ESENT-based database on Service Fabric. Demonstrates how to write a distributed, reliable database which uses Service Fabric for replication.

The ReliableTable<TKey, TValue> class can take part in transactions along with Service Fabric's existing IReliableDictionary & IReliableQueue providers.

Suggestions welcome via Twitter: @ReubenBond or GH issues :)

Example:

In your StatefulService's RunAsync method, obtain a reference to a table:

var journal = await this.StateManager.GetOrAddAsync<ReliableTable<string, byte[]>>("journal");

Then, access the table from one of your service's methods like so

public async Task Insert(string key, string partition, byte[] value)
{
	using (var tx = this.StateManager.CreateTransaction())
	{
		journal.SetValue(tx, key, value);
		await tx.CommitAsync();
	}
}

Ideas for improvement:

  • Use a wholly managed database to avoid calls into native code.
  • Alternatively: chunkify the marshalling via a native library.
  • Use ProtoBuf for serialization of operations, instead of manual binary serialization.
  • Profile & improve performance.

For a higher performance database, implement the IStateProvider2 interface manually and replicate the database journal instead of the application-level operations (is that possible with ESENT?). This implementation uses the TransactionalReplicator from Service Fabric, which maintains its own transaction log, ESENT also maintains a transaction log internally, so there is a duplication of effort.

I give zero guarantees about any of this.

Credits to ManagedEsent which this project borrows from and leverages.

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.