I have a question regarding how the selenium web driver works while multithreading in a Python script on an AWS EC2 Ubuntu server. Specifically, I'm concerned about the memory usage of each thread that is running a headless selenium browser.
Every time my python script runs, I have around 75 threads running simultaneously, each running a
headless selenium browser
. I don't close the browsers bydriver.close()
command, does that mean the thread is still 'active' and using RAM?Let's say I run the script once. I see the logs and I see logs like 'Thread1, Thread 2 ..... Thread 75'. The script finishes and I run it again. Instead of seeing 'Thread1, Thread 3, ..... Thread 75', I see 'Thread 76, Thread 77, until Thread 150'. Does that mean by past threads that were never closed and are using memory? Basically, do they accumulate over time affecting RAM?
I'm just afraid of capping out on memory since I need to scale the app efficiently.