sorry to post another question that doesn’t relate to coldbox directly but I don’t know anywhere to ask it to get a good answer so if you have places to ask coldfusion specific questions, let me know.
My question: Does anyone know how to get the number of running threads & queue threads created by using cfthread?
I have written a small coldbox app that is initiated by cron every minute. The coldbox handler creates multiple cfthreads to download specific content from thousands of locations. Think of it like a Google Bot of sorts. The problem I am running into is that the cfthreads get out of hand after a few hours of running and I have to restart my coldfusion instance.
The reason that the threads are getting out of control is that some sites take longer to download than others. I set everything to a two second timeout however I ‘feel’ like the timeout isn’t always timing out.
I was able to improve things by ‘joining’ all the threads and setting a total thread timeout of 60 seconds at the end of each cron job execution hitting the coldbox handler.
a couple side notes - if I lower the number of threads being created each cron job, it only takes longer before the server crashes.
If I could access the total number of running threads & queued threads, I can have my coldbox handler throttle the number of created threads on each execution.
Jeremy R. DeYoung