You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using your mediator in two projects which are live and so far it has performed well. both the projects are web based. So kudos to you on a very clean and smooth implementation of CQRS.
I'm planning to use it in a much larger system but have a few questions which are not clear to me.
What is the limit of handlers if any? In the system I'm estimating it to cross well over 800. In the projects that I have used it the number has reached to 270 max and so far no issues.
Can we have a dedicated thread pool for the handlers? off course that requires a custom scheduler. I'm thinking of assigning priorities to the commands, queries and with dedicated threads based on priorities of the handlers?
When delving into the code for SimpleInjector.Mediator I noticed that mediator is registered as scoped. As dotnet core apps are mostly long running apps. I'm not clear if it makes sense to register the mediator instance as scoped, isn't it better to have it as singleton?
thanks in advance
The text was updated successfully, but these errors were encountered:
SuheylZ
changed the title
Mediator is registered as Scoped
Few questions about Mediator.NET
Apr 19, 2019
I am glad to hear that Mediator runs well so far for you.
Here are my feedback for your questions
What is the limit of handlers if any? In the system I'm estimating it to cross well over 800. In the projects that I have used it the number has reached to 270 max and so far no issues.
_There is no limit of handlers, and it uses HashSet hence performance should be fine.
Can we have a dedicated thread pool for the handlers? off course that requires a custom scheduler. I'm thinking of assigning priorities to the commands, queries and with dedicated threads based on priorities of the handlers?
_Very good question, I have not tried it myself, in theory you should be able to instanciate a mediator instance and do something like Task.Run(async () => await mediator.Send(aCommand/orAQuery)) which might leavage the threadpool to schedule the task.
When delving into the code for SimpleInjector.Mediator I noticed that mediator is registered as scoped. As dotnet core apps are mostly long running apps. I'm not clear if it makes sense to register the mediator instance as scoped, isn't it better to have it as singleton?
_Mediator itself is not stateless, it has context which might affect other message if it is shared. As instanciating a new instance of IMediator is cheap, having a scoped instace or transient instance is more safe and can reduce side effects.
I hope this helps and looking forward to hear from you soon
Hi Again,
I'm using your mediator in two projects which are live and so far it has performed well. both the projects are web based. So kudos to you on a very clean and smooth implementation of CQRS.
I'm planning to use it in a much larger system but have a few questions which are not clear to me.
What is the limit of handlers if any? In the system I'm estimating it to cross well over 800. In the projects that I have used it the number has reached to 270 max and so far no issues.
Can we have a dedicated thread pool for the handlers? off course that requires a custom scheduler. I'm thinking of assigning priorities to the commands, queries and with dedicated threads based on priorities of the handlers?
When delving into the code for SimpleInjector.Mediator I noticed that mediator is registered as scoped. As dotnet core apps are mostly long running apps. I'm not clear if it makes sense to register the mediator instance as scoped, isn't it better to have it as singleton?
thanks in advance
The text was updated successfully, but these errors were encountered: