Performance variation of a program when run as a webapp and as a standalone
posted 12 years ago
I have a piece of code in my webapp which downloads files from a URL. For a 2 MB zip file the download time is approx 66 secs. Now when I run the same piece of code as a standlone program ( ie invoke the method through a main) the download time of the file drops to almost 1/2 a sec !!
Within the webapp the download is started as a separate thread. And the file that is downloaded is present on the same server. ie URL = localhost.
I am not able to understand why there should be such a huge difference in the download time when the code that runs is the 'same' in both the cases. I have also tried increasing the heap size for the webapp but the time difference between the webapp run of the method and the standlone run remains same.
Can anybody please explain me this behaviour ? Also what changes I should do to achieve the same performance as I get for a standlone run.
Please let me know if more information is required.