dotnet.github.io | The source for the dotnet.github.io site | Web Site library
kandi X-RAY | dotnet.github.io Summary
kandi X-RAY | dotnet.github.io Summary
The source for the dotnet.github.io site
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dotnet.github.io
dotnet.github.io Key Features
dotnet.github.io Examples and Code Snippets
Community Discussions
Trending Discussions on dotnet.github.io
QUESTION
The doc does not explain clearly. I suppose PreferLocalPlacement
works in this way:
When client(out of cluster) sends a request to a grain marked as PreferLocalPlacement
, it chooses a random silo server it knows, and sends the request there.
When the silo server receives the request, it determines if grain with the specified identity was already activated. If not, the grain is activated automatically in this silo.
Thus, each silo server can have max 1 activation of this grain type per an identity.
Do I get it right? Thanks in advance
...ANSWER
Answered 2022-Jan-25 at 17:48Your understanding is close but missing a key aspect of how Orleans finds and places grain activations.
The key is that most placement providers in Orleans rely on a grain directory. That directory stores the current mapping of which grain is activated on which server. Like placement, the directory is configurable. It uses an in-cluster directory by default, where responsibility for storing the mapping is shared among the servers.
Orleans will check the directory first, to see if the grain is currently activated somewhere in the cluster and it will only run the logic in PreferLocalPlacement
when the grain does not currently have a valid entry in the directory.
Therefore, you will have one instance of your grain active in the cluster, not one instance per server. If there are no currently active instances of your grain then PreferLocalPlacement
will always pick the current, local server (or the server which the request first lands on) as long as it is compatible.
Clusters can have a mix of servers each having a different set of grain assemblies loaded. Therefore, placement providers need to take into account whether a given server is compatible with the requested grain type and if it has a compatible version of the interface which is being requested. If it does not support that grain, then a random compatible server will be chosen instead. For more information, see the documentation on Heterogeneous Clusters.
"Most placement providers rely on a grain directory"You might ask which placement providers do not rely on a grain directory. The only answer today is [StatelessWorker]
placement, since [StatelessWorker]
grains can have multiple instances, i.e, each server can have a configurable number of local instances of any given [StatelessWorker]
grain.
QUESTION
I am trying to follow their tutorial for tests: Link to Orleans test docs
But the configuration shown is pretty simplistic:
...ANSWER
Answered 2022-Jan-14 at 21:34The setup needs to be improved. You can check this sample from the official Orleans GitHub page: https://github.com/dotnet/orleans/blob/main/test/TesterInternal/StreamingTests/SMSStreamingTests.cs
So, in your ClusterFixture
class you should add the SiloConfigurator
:
QUESTION
This question is the same as this question. But the OP answered his own question and it didn't help me.
I am trying to create a documentation similar to the Docfx site:
However, when I build the project, I get the index.html that looks like this:
My configuration is this:
- Installed docfx.console as a nuget package in Visual Studio 2017 for the project.
- The version of docfx is 2.58.0.
- I'm building the project in Visual Studio, which produces the docfx output.
My folder configuration is:
...ANSWER
Answered 2021-Sep-01 at 01:10The only way I have ever been able to get that to happen:
Change articles/toc.md to articles/toc.yml:
QUESTION
Cannot get this to run. I get the following error message, I have made it as simple as possible but what required service am I missing.
I am using the Graph Type first approach. https://graphql-dotnet.github.io/docs/getting-started/introduction
...System.InvalidOperationException: Required service for type autumn.TestOGT not found at GraphQL.Utilities.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) in //src/GraphQL/Utilities/ServiceProviderExtensions.cs:line 33 at GraphQL.Types.SchemaTypes.<>c__DisplayClass7_0.<.ctor>b__2(Type t) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 141 at GraphQL.Types.SchemaTypes.AddTypeIfNotRegistered(Type type, TypeCollectionContext context) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 539 at GraphQL.Types.SchemaTypes.HandleField(IComplexGraphType parentType, FieldType field, TypeCollectionContext context, Boolean applyNameConverter) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 429 at GraphQL.Types.SchemaTypes.AddType(IGraphType type, TypeCollectionContext context) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 333 at GraphQL.Types.SchemaTypes..ctor(ISchema schema, IServiceProvider serviceProvider) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 154 at GraphQL.Types.Schema.CreateSchemaTypes() in //src/GraphQL/Types/Schema.cs:line 328 at GraphQL.Types.Schema.Initialize() in //src/GraphQL/Types/Schema.cs:line 102 at GraphQL.Utilities.SchemaPrinter.PrintFilteredSchema(Func
2 directiveFilter, Func
2 typeFilter) in //src/GraphQL/Utilities/SchemaPrinter.cs:line 79 at GraphQL.Utilities.SchemaPrinter.Print() in //src/GraphQL/Utilities/SchemaPrinter.cs:line 63 at Autumn.Api.Controllers.AutumnController.Schema() in C:\ws\Autumn-APICore\Autumn.Api\Controllers\AutumnController.cs:line 37 at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
ANSWER
Answered 2021-Aug-11 at 13:50Error is AutumnQuery is not needed and had int the constructor IServiceProvider
QUESTION
There is a couple of confusing points in the documentation that make me struggle to understand how exactly distribution across the cluster happens in Orleans. Hence, the questions.
Question #1
Orleans claims to have a built-in distribution capabilities to distribute across multiple servers. To me it sounds that Orleans can act as a load balancer itself and can scale out automatically. Thus, if I deploy Orleans app to several servers, then service discovery and load management should happen automatically, correct?
In this case, why some docs and articles suggest using other tools, like Ocelot or Consul, as a single entry point to Orleans cluster?
Question #2
I would like to use simple but distributed in-memory storage across several servers, like Redis or Apache Ignite, and I would like to know if it's possible to use a simple grain as this kind of a data storage?
Let's say, one grain will store a collection of restaurants and some other grain will keep track of the last 1000 visitors for selected restaurant. Can I activate these 2 grains only once as a singleton collection, add or remove records to each collection, and use these 2 grains as in-memory storage evenly available to all nodes in the cluster? Also, if answer is yes, do I need to add locks to these collections or each grain always exists in a single thread?
...ANSWER
Answered 2021-May-30 at 02:05- Service discovery and load management happen automatically indeed. Consul is not a strong required. The only external requirement is a Membership table provider - something that is used internally by Orleans Clustering. There are many build in Membership table providers that come already built-in with Orleans. For example, Azure table storage. all you need is to configure Orleans to use it and of course have Azure storage account. Consul is another alternative to Membership table provider and there are more.
Another thing that does not come built-in is infrastructure scaling. If your service demand increases, something need to ask the infrastructure provider (Cloud Provider) to add more Servers. Once servers are added, Orleans will automatically adjust the workload and load balance across the new servers as well. But figuring out that more servers are needed and adding them is not done by Orleans itself (there likely some externally contributed tools to do that. maybe K8 can be configured to do that? I am not completely sure about that).
- Yes, you can use those 2 grains as in-memory storage, just like you wrote. And no, you do not need to use locks. All grains are single threaded.
QUESTION
I am using GraphQL .net to respond to graphql queries on the backend of an Asp.net Core website. All the cookies seem to be passed with the requests but for some reason my graphql.net requests do not have the proper user session set on the HttpContext. The ClaimPrincipal is mostly empty via graphql.net while my Asp.net Core WebApi/Mvc style endpoints have the correct principal with user id even though both GraphQl.Net requests and non-graphql.net requests are happening at the same time.
I checked the payload and all the same cookies are passed in both requests. So it makes me wonder why are my regular WebApi endpoints able to (auto-magically) get the claims principal and why can't the graph.net endpoints do the same. As far as I know from previous usages of GraphQl.net I wasn't aware that any special session code had to be added (other than passing the user from the HttpContext to graphQL.net). I've been reading through GraphQL.Net and Asp.net core source code and docs, but so far I haven't found any obvious offenses or leads.
What might cause some issue like this? what are some common causes? Should I just try to figure out how to manually read in the cookie to Asp.net core and pull the principal?
Perhaps I'm missing a special header value? I don't think the headers are weird but I haven't done a side by side comparison between the headers in graphql.net and asp.net core requests.
In this snippet is where I first detect a problem. If I put a breakpoint here then the claimsprinical isn't correctly set for the current user session. And also later when I access the HttpContext the user session is not correct for graphql.net requests.
...ANSWER
Answered 2020-Nov-30 at 21:56What does your Configure
method look like? Is your app.UseAuthentication()
before your GraphQL middleware configuration?
QUESTION
In GraphQL .Net most of the example code has one top level mutations graph object that has many actual mutations defined within it.
Here's an example from the GraphQL .NET mutations page:
ANSWER
Answered 2020-Nov-09 at 17:14https://graphql-dotnet.github.io/docs/getting-started/query-organization
You can "group" queries or mutations together by adding a top level field. The "trick" is to return an empty object in the resolver.
QUESTION
Usually, it's recommended to create a wrapper implementing IHttpClient
or IHttpClientFactory
. Meanwhile, some Orleans samples show that it's ok to create HttpClient
instance on-demand and use it directly from the grain.
Questions
- Should I create Orleans service as a wrapper around
IHttpClient
or call HttpClient directly from the grain? - If I need a wrapper, would this implementation suffice?
- What's the difference between
GrainService
andGrainServiceClient
?
ANSWER
Answered 2020-Sep-30 at 23:36You should follow standard best-practices when using HttpClient
within Orleans. The sample is creating a new one for simplicity of exposition, not as an indicator of best practices. A PR to change the sample documentation to use IHttpClientFactory
(for example) would likely be accepted.
You do not need a GrainService
to call into HTTP services from your grain: you can inject the required dependencies (IHttpClientFactory
or your typed client) and call HTTP services directly from grain code.
Regarding the question on the purpose of GrainService
and GrainServiceClient
, GrainService
is a special service which is intended to be accessed from grain code. GrainServices
are instantiated on every node in the cluster and each one is given responsibility over a set of grains. As an example, reminders (persistent timers) in Orleans are implemented using GrainService
s. The LocalReminderService
on each node takes responsibility for a set of grains and will wake those grains up when their reminders are due. GrainServiceClient
is used by grains to access the GrainService
instance which is responsible for the calling grain. The documentation explains more here: https://dotnet.github.io/orleans/Documentation/grains/grainservices.html
I would avoid using GrainService
unless you find a use case which it fits closely.
QUESTION
For monitoring purposes, I need to log and measure every grain call (already available through Grain Call Filters), but also every grain activation/deactivation to have Grain Type counters, also for auto-scaling purposes.
I haven't found any global hooks besides Incomming and Outgoing grain call filters
Is there any way to get into the lifecycle of Grains in a global manner, besides the Incomming and Outgoing call filters?
...ANSWER
Answered 2020-Sep-30 at 15:27Yes, you can using a feature in orleans called life-cycle participation which is available for grains and silos as well.
You should check out the documentation site
QUESTION
I tried to start using DocFX and it meets my requirements, but I have a minor problem that is quite bothersome in the long run.
Every time I change something in the project and enable debugging, the DocFX's nuget adapts to the new changes.
This is correct behavior, but I would like to be able to turn this off for some time. It doesn't take long, but due to frequent changes it significantly extends the time to test anything.
I was looking in user Manual: https://dotnet.github.io/docfx/tutorial/docfx.exe_user_manual.html and I tried to do it on my own, but I didn't find any way to do that except to throw the nuget out of the project.
...ANSWER
Answered 2020-Jun-16 at 09:34How to turn off DocFX build each time i rebuild project in Visual Studio [2019] [NuGet]
This is the feature of the nuget package docfx.console
and I suggest you could turn off this nuget package temporarily by this way:
Use a new configuration which removes the docfx
nuget package to test it.
1) add a new configuration called test
2) If it is a net framework project with packages.config, you should
change this in xxx.csproj
file:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dotnet.github.io
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page