Dealing with the 30 second proxy refresh time?

noellarkin

Senior Member
Joined
Mar 14, 2021
Messages
1,006
Reaction score
1,492
I've set up some 4g routers for personal use. I've written a script that reboots the devices every 30 minutes, to get a new IP. However, during the rebooting process, there's around 30 seconds of downtime.
How do you deal with this downtime? Do you switch to a different set of routers/dongles? Switch to an ethernet connection? Or just deal with it?
 
If 30 seconds of delay matters your use case you will need to switch.
Else just deal with it.
 
It's normal to have downtime. So I think dealing with it is the way to go.
 
on a phone i have 5 seconds downtime, so perhaps that's related to your devices or an isp; check different configurations
 
30 seconds seems a little excessive. If you need rotation without the downtime, rotating residential proxies could work. Unless you need 4g proxies specifically
 
I think 30 seconds is normal
I've set up some 4g routers for personal use. I've written a script that reboots the devices every 30 minutes, to get a new IP. However, during the rebooting process, there's around 30 seconds of downtime.
How do you deal with this downtime? Do you switch to a different set of routers/dongles? Switch to an ethernet connection? Or just deal with it?
 
Why? Why are you commenting here without absolutely no expertise to answer OPs question?

"deal with it", are you serious? Why would OP just accept that shitty rotation time if OP wants it improved?

The solution is simple - instead of rebooting the dongle, switch between 4G/3G and turn mobile data off, and then on.

That's it, you will have 4-5 second rotation time.

For some carriers switching the band will do the trick as well and it will increase the rotation time even more.

You will need to implement fallbacks to hard reset if dongle fails to rotate using this approach or just hangs(if you use huawei)

To absolutely remove the downtime - have a pool of spare dongles waiting to take over the work till the dongle is rotated.
 
The solution is simple - instead of rebooting the dongle, switch between 4G/3G and turn mobile data off, and then on.

That's it, you will have 4-5 second rotation time.

For some carriers switching the band will do the trick as well and it will increase the rotation time even more.

You will need to implement fallbacks to hard reset if dongle fails to rotate using this approach or just hangs(if you use huawei)

To absolutely remove the downtime - have a pool of spare dongles waiting to take over the work till the dongle is rotated.
Thanks @lucky.sparks this is exactly the information I needed. Will test and report back.

Here are some other solutions I tried so far:
1. Fallback to Ethernetconnection during restart: I did this by setting up a rudimentary inter-process communication between my ProxyRefresh script and my browser automation script - - whenever the ProxyRefreshscript starts, it pings the automation script, and the automation script un-sets the proxies and continues running the script. Another ping when ProxyRefresh ends, and the automation script returns to using the proxies.
I didn't like exposing my Ethernet connection IP, so I'm not too keen on this solution.
2. Fallback to a router/dongle - - same IPC as before, but it switches to a spare dongle. I don't particularly like this one because it means for 30 sec all the scripts will be running on a single proxy. To make this work, I would have to have more than just 1 spare router/dongle.
3. A load-based refresh - all my automation agents communicate with a central database to log their start times, the task they're currently performing etc, and this includes which proxy they're currently using in relational tables. I wrote a cron job that checks if any of the proxies are unused (have no related agents) and refresh the ones that are unused, setting a flag refreshing=1 to prevent race conditions like an automation agent attempting to use a proxy that the ProxyRefresh script is just about to assign for refreshing. This works in my unit tests, but it fails in real-world scenarios because the number of automation scripts is far higher than the number of proxies I'm using, so none of the proxies are ever "idle".
 
Thanks @lucky.sparks this is exactly the information I needed. Will test and report back.
Brought down the downtime to around 15 seconds with the 4G->3G and 3G->4G thing. To clarify, the API requests (to the router admin) themselves just take around 2-4 seconds each, so a max of 8 seconds. But I'm testing downtime plus the time it takes for a new URL to open, right after the API requests, so that's 8 sec + around 7-8 secs for a new URL to open.
 
For some carriers switching the band will do the trick as well and it will increase the rotation time even more.
Band switching didn't work for me, unfortunately - - the command for band switching in the router seems to involve 2 POST requests, one for switching the bands, immediately followed by a POST request for rebooting the router - - the new band config doesn't get used until the router is rebooted.

However, the 4G/3G/4G thing works great, I think I'll stick to it + use my IPC between automation script and Proxy refresh script to take care of any residual downtime.
 
You can temporary forward traffic from proxies that are being in reboot(or airplane mode) state to working ones.
 
the closer you will be to tower with better coverage, the faster it will switch
And that's how you solve a problem, a classic workaround approach. And then instead of doing some technical nonsense that you don't even understand, have a nice barbecue. :rolleyes: The best is code that which is removed... (I mean, removing complexity)
 
Back
Top