/Kronos

Kronos - Open Source distributed cache system

Primary LanguageC#OtherNOASSERTION

Kronos NuGet version

Kronos is distributed, in-memory cache system based on .NET Core. Client library is available by Nuget.

Build status

Windows Linux
Build status Build status

Known performance issues

  • Google protobuf library doesn't support async read/write operation. Because of that, reading from the network stream is synchronous what blocks the thread. #184
  • A package travels via protobuf, which always allocates new memory for the request. It means that we allocate a new array of bytes for new package. It must be changed.

Docker Image

Docker Stars

Kronos.Client - Installation

$ Install-Package Kronos.Client

Kronos.Client - Usage

// initialize client
KronosClient client = KronosClientFactory.FromIp("127.0.0.1", 44000);

// create a key, package and expiry date
string key = "key";
byte[] packageToCache = Encoding.UTF8.GetBytes("Lorem ipsum");
DateTimeOffset expiryDate = DateTimeOffset.UtcNow.AddDays(5);

// insert package to server
InsertResponse insert = await client.InsertAsync(key, packageToCache, expiryDate);

// get package from server
GetResponse getResponse = await client.GetAsync(key);

// check if storage contains given key
ContainsResponse contains  = await client.ContainsAsync(key);

// count number of elements in the storage
CountResponse number  = await client.CountAsync();

// Optionally you can delete object from cache using Delete command
DeleteResponse delete = await client.DeleteAsync(key);

// or flush all storage
ClearResponse clear = await client.ClearAsync();

Server initialization using docker image

To start server using docker, login as a sudo and type:

docker run -td -p 44000:44000 lukaszpyrzyk/kronos 44000

where:

  • t - allocate a pseudo-tty
  • d - start a container in detached mode
  • p - assign public port 44000 to internal 44000
  • lukaszpyrzyk/kronos - name of the image, https://hub.docker.com/r/lukaszpyrzyk/kronos/
  • 44000 - number of internal port, value passed to the Kronos

Full documentation is available on the docker reference page

Building own docker image

If you don't want to use my docker image, you can build your own. Install .NET Core 3.1. You need to clone repository and then call the script:

cd ./Src/Kronos.Server/
dotnet publish -c Release
docker build --no-cache -t lukaszpyrzyk/kronos .

University

I am a student of Opole University Of technology and this is my Engineering Thesis.

License

MIT