Threading on Python
-
20-01-2021 - |
Question
I am working on a program which logs memory usage on a server. The server has multiple instances running, and the program is logging all.
I am trying to figure out what would be more optimal.
Options:
(Assuming two instances)
1. Single Thread Program, which handles each instance, one by one. Time delay 0.5 seconds.
2. Double Thread, each handling one instance, Time Delay : 1 second.
Any suggestions?
Solution
Both options are perfectly fine. Note that writing a single-threaded program is way easier, so unless you have tight performance requirements or timing constraints, you should forgo threads in favor of faster development and less bugs.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow