If you have multiple browser threads then you can add a date column in database for each account. When some action is finished then you can add 30 minutes to the date now and add it to the database of that particular account. Then add a check condition in the beginning of the thread which checks if the current date is less or greater than the database date. If it is greater that means there is still time left and then close that thread without opening browser.
High cpu usage when using 30+ threads
-
Hello;
I have created a small twitch viewer bot which I have been working on for a few days now.
Everything works pretty good now, except for when using high number of threads it will eat CPU like crazy!Processor Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4001 Mhz, 4 Core(s), 8 Logical Processor(s)
Installed Physical Memory (RAM) 32.0 GBI seen where using http client you can run up to 2k threads very efficiently.
So main question is would loading the twitch video player in HTML which requires FLASH actually work?
And also if it would not work is there anyway to decrease the CPU usage on the original script I made?Thanks,
Alpha. -
@alphacasters With browser it will usage CPU just like if you open 30 different browser on one machine or 30 firefox profile,. That why if just http client can handle up to 2k thread because without interface :)
Try to deny jpg,jpeg etc but HTML5 player or flash still fine.
Hope it will help you,
Regards -
Thank you for the reply!
Now I just have to figure out how to deny the jpegs and such I haven't found it yet :p
EDIT: FOUND IT :)
-
@alphacasters
How to optimize script - http://wiki.bablosoft.com/doku.php?id=how_to_optimize_script