I wonder how .NET programmers deal with "big" tasks.
For example, a website user uploads a video file and our service should add some visual to it.
In Python, I would use Celery (or maybe just crontab) or RabbitMQ with some microservice to run the task separately from the website's execution thread.
I know there is async/await. And my intuition is that I can easily do some not heavy things using async/await approach - say, make a json request and just wait for it to be executed. But it seems that realy heavy tasks better be executed in a separate application or microservice. Am I right?
But what is .NET's approach?
CodePudding user response:
I would indeed recommend to do that outside the webservers process. You could use a Worker Service for that. Worker Services are actually meant to do this kind of heavy lifting. In combination with a rugged scheduling system like Quartz you could periodically scan for new video files and process them. I have used (in production) a combination of both to run quite a bunch of out-of-webserver-process jobs with great success.
CodePudding user response:
Micro services are a good solution for these scenarios if the following requirements are included Otherwise, the use of https://docs.microsoft.com/en-us/dotnet/core/extensions/workers is recommended
When to Use Microservices:
1- When you want your monolithic application to accommodate scalability, agility, manageability and delivery speed.
2- When you have to rewrite legacy applications in today’s programming languages or tech stacks to keep up with modern-day business requirements and solutions.
3- When you have standalone business applications or modules that have to be reused. across diverse channels—some good examples would be login services, search options authentication facilities and more.
4- If you’re building a highly agile application (product or service) that demands swift speed of delivery, innovation and more.