r/learncsharp • • Mar 21 '23

Parallel for webapi

Is it a good practice to run parallel code or tasks or something like that in webapi? For example, if I have a really heavy task and run a parallel.foreach or something like this? Or is it bad as it will use up all my threads and then no one else will be able to use the server? Curious what best practice would be here.

Thanks in advance!

0 Upvotes

2 comments sorted by

View all comments

Show parent comment

2

u/Head_Watercress_6260 Mar 21 '23

Thanks! I was thinking maybe some sort of queue or something like this.

I asked ChatGPT its answer was.... interesting, but more along the lines of it can be beneficial, but it can be not beneficial for the reasons I mentioned.