• Post Reply Bookmark Topic Watch Topic
  • New Topic

Amazon S3 issue in web applications

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, I made another post about this on SO, but ended up with no results - http://stackoverflow.com/questions/31176998/amazon-s3-issue-in-web-applications


Please have a look at the below code.


I am using this code to list the buckets I have in amazon s3. However this process is extremely slow, it takes almost 1 minute or more. Not only that, this takes lot of memory, almost freezing the Google Chrome. My bucket is in US standard region and my application is running in a PC located in south asia.

The delay is in connection configuration. I noticed this is not taking any time delays when it is running in non web java applications. I ran this in a simple `Main` class which is not web based, and it worked fine, fast.

I am using Netbeans IDE and the above code is a part of a servlet. The server I am using is apache tomcat 7.

Any ideas why this is taking this much of time? I added all the JAR files came with Amazon SDK for Java as well. It has no use to me if this takes this long.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As already pointed out in the SO thread, you are not writing any response back to the browser.
What are the timestamps of the console messages "I am in" and "done" when running as web app? Is their difference much higher compared to that in the console application?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should build and test your S3 access in a separate class rather than in a servlet. Much easier to debug that way.

Bill
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter that I am not writing back to the browser, because I can see what is happening in console and I do have set console messages. Regarding writing the s3 thing in another class and calling It via the servlet I have tried that thing too. It has the same situations as the thing what you can see here. I am wondering whether this is related to apache. I think this is either to relates to apache, localhost or xampp
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!