I have a service fabric application with one stateless service and multiple stateful services. The stateless service reads from RabbtitMQ(using MassTransit) and passes the message to corresponding stateful services to process it.The message passed to stateful service is queued in ConcurrentQueue and in RunAsync it dequeue and process. It was fine until there where less number of messages. Recently the number of messages increased multiple folds. Now the situation is message count in RabbitMq is in millions and the stateful service queue gets overloaded. The memory usage became very high and the cluster gets stuck.
- Does the queue gets locked during enqueue process that the RunAsync method needs to wait. Enqueue are very high.
- I'm not able to find a way to stop fetching from RabbitMq if the queue count is very high. Atleast the cluster won't hang or crash.
- What will be the best design follow in situations where input load is very high?
Thanks
1.
show your code (producing and consuming messages)2.
why do you need stateful services?3.
why do you need separate stateless service to read queues? why not read messages in stateful services? – mtkachenko