Open xitep opened 7 years ago
I definitely agree we might hit this issue in the future. But since there is still no ban or captcha from remote web-servers it seems ok so far :smile:
We must not forget shortening services are kind of servers that are designed to handle more less "infinitely large" load.
But in any case this issue is something that needs to be considered.
It's possible to issue enough "random" requests against url-expander at the same time, such that it then itself issues parallel requests to the same target web server, potentially overloading it.
Test case
A simple server to count concurrently handled requests (this be a remote server hosting the short link redirects):
Running this and url-expander on the same machine, one way to simulate the problem is as follows.
The
us
server output then shows something along the lines of:Unfortunately, I couldn't find any way to grab the remote IP of a once established connection to build up a "live map" of currently executed work. Maybe resolving it upfront using net.LookupIP is just fine (but, unlike Java, it seems Go does no caching in this regard.)
Of course, this issue is not critical in controlled environments; rather just something to consider when exposing url-expander to the public.