I’m working on a Python script that needs to run DNS queries for multiple domains in parallel, and I want to use the subprocess module to execute dig commands. I’ve been able to run individual queries using subprocess.run(), but I’m not sure how to scale this by running several DNS queries at the same time without blocking the execution of the script.
What’s the best way to use subprocess to achieve parallel execution of DNS queries? Should I use threading or multiprocessing in combination with subprocess, or is there a simpler solution? Any examples on how to handle this efficiently would be helpful.