AVeryWetFish
Newbie
- Mar 8, 2017
- 2
- 0
I’ve got a custom written script that is pulling data from a website fairly frequently. The website is massive, most of you would have heard of it - though I strongly doubt anyone here has done anything like this. I've hit a point where I'm at a loss how to speed things up (latency is very important for me). From what I can see by manipulating and mutating some URL parameters I can avoid being returned cached data from Akamai - but I've noticed strange behaviour I can't explain.
From my experiments/experience if I run the script using the same pool of proxies using multiple threads, querying around once per a second (per thread) there can be 3-20 seconds delays between each thread acknowledging the change (while still querying once a second). Also, even once a thread gets the newest data, the next query from the same thread (but different proxy) can return the old data. This is a pretty massive delay for me as I'm being beaten by competitors. The cache headers returned from the query show it’s probably not being cached (Expiry - Date = 90) which matches the cache control they're using.
List of things I've tried (with limited success):
(I've tried countless other things - but won't list them here. I'm hoping for a niche thing that someone with a lot of experience could know to help).
My understanding of distributed systems is limited and I might be missing something obvious - I originally assumed the data might be distributed, but from small things I’ve been noticing I’m not sure if this is the case.
My code is private and I’m not going to share any of it here, sorry. The code itself is solid and there’s little I can do to speed it up. The program does the following:
For any reasonable suggestion that makes an noticeable speed/performance improvement I’d happily send of a minimum of $50 BTC, probably more depending on the effect. Post any suggestions/tips below and I’ll let you know how they go.
From my experiments/experience if I run the script using the same pool of proxies using multiple threads, querying around once per a second (per thread) there can be 3-20 seconds delays between each thread acknowledging the change (while still querying once a second). Also, even once a thread gets the newest data, the next query from the same thread (but different proxy) can return the old data. This is a pretty massive delay for me as I'm being beaten by competitors. The cache headers returned from the query show it’s probably not being cached (Expiry - Date = 90) which matches the cache control they're using.
List of things I've tried (with limited success):
- The obvious no-cache headers
- Appending a random parameter/value to the URL (has no effect - I have to mutate and randomly generate the url to avoid Akamai's cache)
- Try different locations for the proxies (EU/USA/Russia/China - no single location seems to be the best.)
(I've tried countless other things - but won't list them here. I'm hoping for a niche thing that someone with a lot of experience could know to help).
My understanding of distributed systems is limited and I might be missing something obvious - I originally assumed the data might be distributed, but from small things I’ve been noticing I’m not sure if this is the case.
My code is private and I’m not going to share any of it here, sorry. The code itself is solid and there’s little I can do to speed it up. The program does the following:
- Spawn multiple threads for each item type I’m searching for.
- Each thread runs independently, using the shared pool of proxies that rotates after a single use.
- Getting data from a url (in JSON)
- Decoding and processing anything new from within it.
For any reasonable suggestion that makes an noticeable speed/performance improvement I’d happily send of a minimum of $50 BTC, probably more depending on the effect. Post any suggestions/tips below and I’ll let you know how they go.