Code Monkey home page Code Monkey logo

orleans.storageprovider.redis's Introduction

Orleans.Redis

Orleans Redis Providers

1.5.x branch Build status 2.x.x branch Build status

Orleans is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.

Orleans.Redis is a package that use Redis as a backend for Orleans providers. It uses the great StackExchange.Redis library underneath.

Installation

PS> Install-Package Orleans.Persistence.Redis -prerelease

Usage

Configure your Orleans-cluster.

var silo = new SiloHostBuilder()
    .AddRedisGrainStorage("Redis", optionsBuilder => optionsBuilder.Configure(options =>
    {
        options.DataConnectionString = "localhost:6379"; // This is the deafult
        options.UseJson = true;
        options.DatabaseNumber = 1;
    }))
    .Build();
await silo.StartAsync();

Decorate your grain classes with the StorageProvider attribute.

[StorageProvider(ProviderName = "Redis")]
public class SomeGrain : Grain<SomeGrainState>, ISomeGrain

These settings will enable the redis cache to act as the store for grains that have

  • State
  • Need to persist their state

Configuration

  • DataConnectionString="..." (required) the connection string to your redis database (i.e. localhost:6379, is passed directly to StackExchange.Redis)
  • UseJson=true/false (optional) wether or not to persist state as a JSON string or not. Defaults to false
  • DatabaseNumber=1 (optional) the number of the redis database to connect to. Defaults

License

MIT

orleans.storageprovider.redis's People

Contributors

brianqcgames avatar galvesribeiro avatar mend-bolt-for-github[bot] avatar riccardobecker avatar richorama 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

Watchers

 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

orleans.storageprovider.redis's Issues

ReadStateAsync does not have an implementation.

Getting the error above when using Orleans v1.2.3. Is this package updated to the latest of Orleans? Or am I doing something wrong?

Error:

System.TypeLoadException: Method 'ReadStateAsync' in type 'Orleans.StorageProviders.RedisStorage' from assembly 'RedisStorage, Version=1.0.9.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

More stack trace:

OrleansHost.exe Error: 0 : [2016-07-19 20:53:24.045 GMT 1 ERROR 101716 AssemblyLoader.Silo 127.0.0.1:11111] !!!!!!!!!! An unexpected exception occurred while attempting to load an assembly.
Exc level 0: System.AggregateException: A ReflectionTypeLoadException has been thrown. The original exception and the contents of the LoaderExceptions property have been aggregated for your convenience.
at Orleans.Runtime.Utils.Flatten(ReflectionTypeLoadException rtle)
at Orleans.Runtime.AssemblyLoaderReflectionCriterion.<>c__DisplayClass3_0.b__0(Assembly assembly, IEnumerable1& assemblyComplaints) at Orleans.Runtime.AssemblyLoaderCriterion.EvaluateCandidate(Object input, IEnumerable1& complaints)
at Orleans.Runtime.AssemblyLoader.ShouldLoadAssembly(String pathName)
Exc level 1: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeAssembly.get_DefinedTypes()
at Orleans.Runtime.AssemblyLoaderReflectionCriterion.<>c__DisplayClass3_0.b__0(Assembly assembly, IEnumerable`1& assemblyComplaints)
Exc level 2: System.TypeLoadException: Method 'ReadStateAsync' in type 'Orleans.StorageProviders.RedisStorage' from assembly 'RedisStorage, Version=1.0.9.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Exc level 1: System.TypeLoadException: Method 'ReadStateAsync' in type 'Orleans.StorageProviders.RedisStorage' from assembly 'RedisStorage, Version=1.0.9.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

Newtonsoft.Json.Linq.JArray' cannot be converted to type 'System.Collections.Generic.HashSet`1[Orleans.Streams.PubSubPublisherState]'.

I'm getting occasionally failures using PubSubStore and streams

Exc level 0: Orleans.Runtime.OrleansException: Forwarding failed: tried to forward message NewPlacement Request S172.18.124.92:11111:192315922_cli/916eb7ad@cdeb1280->S172.18.124.91:11111:192315927_grn/716E8E94/00917a8c+SMSProvider_ProvingGroundStreamNamespace@2b9109a6 #4[ForwardCount=2]: global::Orleans.Streams.IPubSubRendezvousGrain:GetAllSubscriptions() for 2 times after Failed SetupActivationState to invalid activation. Rejecting now. System.ArgumentException: Object of type 'Newtonsoft.Json.Linq.JArray' cannot be converted to type 'System.Collections.Generic.HashSet`1[Orleans.Streams.PubSubPublisherState]'.

at first look there appears to be data in the redis:
GrainReference=40628da454c29730b799065600917a8c06000000716e8e94+SMSProvider_ProvingGroundStreamNamespace

{
"Producers": [{
"Stream": {
"Guid": "54c29730-8da4-4062-8c7a-9100560699b7",
"ProviderName": "SMSProvider",
"Namespace": "ProvingGroundStreamNamespace"
},
"producerReference": {
"GrainId": "4bb741b3bb9b2fc5b5d0dd2d95a65db60400000000000000",
"ObserverId": "ea9e95e9-2a23-4c25-b504-35352a638417",
"GenericArguments": ""
},
"Producer": {
"GrainId": "4bb741b3bb9b2fc5b5d0dd2d95a65db60400000000000000",
"ObserverId": "ea9e95e9-2a23-4c25-b504-35352a638417",
"GenericArguments": ""
}
},
{
"Stream": {
"Guid": "54c29730-8da4-4062-8c7a-9100560699b7",
"ProviderName": "SMSProvider",
"Namespace": "ProvingGroundStreamNamespace"
},
"producerReference": {
"GrainId": "4face51f0b478c231bfa2ffd97031fa20400000000000000",
"ObserverId": "ec03e62d-c6c4-4225-8336-02cd42f85ed5",
"GenericArguments": ""
},
"Producer": {
"GrainId": "4face51f0b478c231bfa2ffd97031fa20400000000000000",
"ObserverId": "ec03e62d-c6c4-4225-8336-02cd42f85ed5",
"GenericArguments": ""
}
},
{
"Stream": {
"Guid": "54c29730-8da4-4062-8c7a-9100560699b7",
"ProviderName": "SMSProvider",
"Namespace": "ProvingGroundStreamNamespace"
},
"producerReference": {
"GrainId": "47d5eda872f7ffa8218ab7edc4ef4d990400000000000000",
"ObserverId": "fe9b44ea-8d70-4cb9-b207-ad0bd938731d",
"GenericArguments": ""
},
"Producer": {
"GrainId": "47d5eda872f7ffa8218ab7edc4ef4d990400000000000000",
"ObserverId": "fe9b44ea-8d70-4cb9-b207-ad0bd938731d",
"GenericArguments": ""
}
}],
"Consumers": [{
"SubscriptionId": {
"Guid": "8f83c9f6-8154-4c72-8778-dc45e306c100"
},
"Stream": {
"Guid": "54c29730-8da4-4062-8c7a-9100560699b7",
"ProviderName": "SMSProvider",
"Namespace": "ProvingGroundStreamNamespace"
},
"consumerReference": {
"GrainId": "4c03cc653af97b91b6774b5bb124e4890400000000000000",
"ObserverId": "ec4a471d-0925-4887-97af-e6eb8ac2dde4",
"GenericArguments": ""
},
"filterWrapper": null,
"state": 0,
"Consumer": {
"GrainId": "4c03cc653af97b91b6774b5bb124e4890400000000000000",
"ObserverId": "ec4a471d-0925-4887-97af-e6eb8ac2dde4",
"GenericArguments": ""
},
"Filter": null,
"IsFaulted": false
},
{
"SubscriptionId": {
"Guid": "0356ae2a-f02a-4bf0-bb66-f3630bbf0324"
},
"Stream": {
"Guid": "54c29730-8da4-4062-8c7a-9100560699b7",
"ProviderName": "SMSProvider",
"Namespace": "ProvingGroundStreamNamespace"
},
"consumerReference": {
"GrainId": "4ba6ba7f381df37ede4a5c556a2231b50400000000000000",
"ObserverId": "9006ceb8-5848-45e9-bfc1-666f08bdcda1",
"GenericArguments": ""
},
"filterWrapper": null,
"state": 0,
"Consumer": {
"GrainId": "4ba6ba7f381df37ede4a5c556a2231b50400000000000000",
"ObserverId": "9006ceb8-5848-45e9-bfc1-666f08bdcda1",
"GenericArguments": ""
},
"Filter": null,
"IsFaulted": false
},
{
"SubscriptionId": {
"Guid": "baad2119-2b82-45df-860b-2f89b0237520"
},
"Stream": {
"Guid": "54c29730-8da4-4062-8c7a-9100560699b7",
"ProviderName": "SMSProvider",
"Namespace": "ProvingGroundStreamNamespace"
},
"consumerReference": {
"GrainId": "45df620b45579f6fc5cc151f1a907fa60400000000000000",
"ObserverId": "998c8f28-cb63-4943-9460-38c1eb7bf8fc",
"GenericArguments": ""
},
"filterWrapper": null,
"state": 0,
"Consumer": {
"GrainId": "45df620b45579f6fc5cc151f1a907fa60400000000000000",
"ObserverId": "998c8f28-cb63-4943-9460-38c1eb7bf8fc",
"GenericArguments": ""
},
"Filter": null,
"IsFaulted": false
},
{
"SubscriptionId": {
"Guid": "1c3ea63e-3d8b-4adc-840f-96c4c700b46e"
},
"Stream": {
"Guid": "54c29730-8da4-4062-8c7a-9100560699b7",
"ProviderName": "SMSProvider",
"Namespace": "ProvingGroundStreamNamespace"
},
"consumerReference": {
"GrainId": "4fe65043ebf3e9e2150d84f2eff1898d0400000000000000",
"ObserverId": "38b0ac35-0258-4879-8d4b-cc33052ba485",
"GenericArguments": ""
},
"filterWrapper": null,
"state": 0,
"Consumer": {
"GrainId": "4fe65043ebf3e9e2150d84f2eff1898d0400000000000000",
"ObserverId": "38b0ac35-0258-4879-8d4b-cc33052ba485",
"GenericArguments": ""
},
"Filter": null,
"IsFaulted": false
}]
}

Using an AED on this project

All,

I'm going to try to revive this project (I want redis persistence for performance reasons). I see several PRs and several issues outstanding and have been for quite some time.

  • Lets skip trying to getting Orleans 1.x operational
  • Lets take @martinothamar's PR #22 , which is on the dev branch (I like his unit tests)
  • Lets merge dev to master
  • I can get the appveyor under OrleansContrib account working
  • Add https://www.nuget.org/packages/redis-inside/ to get the unit tests working
  • Rename the repo ?????? to Orleans.Persistence.Redis
  • Publish nuget for Orleans.Persistence.Redis

Fix CI builds

Builds are broken and no nupkgs are published. Looking to use this in a couple of projects so would be very happy if someone took the time to fix the CI stuff

Wrong key of GrainReference saving

I'm using this packet as persistent storage for PubSubStore in streams. And if Grain is activated - it can't be activated anymore using sterams.

Exception:
Orleans.Runtime.GrainReferenceNotBoundException: Attempted to use a GrainReference which has not been bound to the runtime: GrainReference: *grn/Grains.PlayerGrain/0+f8d845a6-d808-486b-a002-aa218a8e8e65-0x0730A938. Use the IGrainFactory.BindGrainReference method to bind this reference to the runtime.

Question

I catch error in last release (nu-get): "Missing realization method 'ReadStateAsync' in type 'Orleans.StorageProvider.Redis.RedisStorageProvider' ".

Thanks

Orleans 1.5 compatible release?

Hi guys,

I've noticed that the changes required for Orleans 1.5 compatibility are in. Would it be possible to release a corresponding Nuget package? We can of course build a package ourselves, but hey, getting it from Nuget would be preferable.

Thanks!

Project Status

We have an orleans cluster using azure blob storage for state persistence, We'd like to try redis for better performance.
@martinothamar i see you have a fork with more recent code, including Etag support, what's the status on that? is it going to be merged here? would you consider the fork production ready ?

Also, we're still on orleans 1.5.x is there anyway to use this on 1.5.x? i see @martinothamar version works very differently with lua scripts and etag, support, any advce on how to back port this to 1.5.x?

Thanks!

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.