Is good idea to use parallel programming in pods

5/28/2018

I'm starting with k8s, and i have little problem with parallel processing in my pods.

Currently I'm using dot.net core platform with c# 7.2 for my application with is running in pods. I'm trying to use parallel task in apps, but it looks lika application is using only one core.

So I'm thinking that I should use only async/await pattern for this application and solve parallel processing by numbers of the pods in deployment settings. Is this opinion correct?

Thanks for help.

-- Jan Válek
c#
kubernetes
parallel-processing

1 Answer

5/28/2018

When to use Parallel API ?

You have a CPU intensive task and wanted to ensure all the CPU cores are effectively utilized. Parallel calls are always blocking operation for main / Ui thread

When to use Async Await ?

When your aim is to do processing Asynchronously (In background), thus allowing Main / UI thread to remain responsive, main use case is calling remote processing logic like Database query, which shall not block the server thread. Async AWait used for in memory processing is mainly meant to allowing the Ui thread responsive for the end user, but that would still use Thread pool thread, which is not the case for IO processing, no pool threads are used

Regarding Kubernetes set up ?

Since this is an orchestration mechanism for the Docker, which virtualize the OS resources for setting up the Docker containers, so you may have to ensure that there's no setting configuration, which is restricting the total assigned CPU Cores, just having an adverse impact on the overall performance. This aspect will be outside the ambit of .Net Parallel APIs

-- Mrinal Kamboj
Source: StackOverflow