Closed bmwhite20 closed 2 years ago
As I understand it, it is a matter of Kafka's own implementation. If you want to understand the CPU difference between the two ways of writing code. Then Kafka should not be introduced.
As for Kafka itself, it is actually recommended to use Consume with Timeout, and I think this case may be related to your question. https://github.com/confluentinc/confluent-kafka-dotnet/issues/1261
It's definitely related with Kafka
Hi David,
Hope you are doing well!
Following your (awesome) async guidance, I'm having a strange behavior while testing a long-running message consumer with Task.Run vs Background Thread.
Code sample:
Test conditions:
Background thread![image](https://user-images.githubusercontent.com/46956995/139221476-803e71e9-5cb7-4701-bd0b-222791606e09.png)
Task.Run![image](https://user-images.githubusercontent.com/46956995/139221651-26df4321-8de4-4da1-a094-efd10333fe4d.png)
As we can see, pods running with background thread are struggling the CPU.
Do you have any thoughts why it happens?
Code: https://github.com/bmwhite20/cpu-workload
Best, Bruno