Sometimes HttpURLConnection.getInputStream executes too slowly

前端 未结 6 1320
情深已故
情深已故 2020-12-09 12:56

We have next code.
Sometimes we should wait 10-20-40 seconds on the last line.
What can be the problem?

Java 1.4

URL url = ...;
HttpURLConn         


        
6条回答
  •  被撕碎了的回忆
    2020-12-09 13:06

    One thing I would guess is that your DNS server isn't responding well.

    Can you experiment with changing symbolic domain names to numeric IP addresses before you start? Or can you do each request twice (just for experimentation) and see if the first request is significantly slower than the second?

    Google has put up a DNS server at (among others) 8.8.8.8 . They claim it's faster than most other DNS servers. Give that a try!

提交回复
热议问题