0

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Right now the priority is not fast-development, but better results, as the number of instances go upto 6-7 at times, and the log files do have some basic statistic calculations.
@Parag Gupta In Python, you'll have to watch out for the GIL anyway (i.e. use multiprocessing instead of threading if your program is CPU-bound). Still, I'd always start with the simpler option. If you design your program carefully (for example, don't use global variables, have an independent method that measures a single instance once, etc.), you can still switch to multiple threads once it becomes necessary.
Thanks. I think I would go with a single thread in that case. If it becomes in-accurate later, would switch. =)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.