I am using Aws SimpleDb to store data for my android app. Using AWS android SDK, I am getting very late responce, is there any way to improve it, in browser, it is getting data in 300 milliseconds for me it is taking about 5 to 10 seconds some times more then that also though i am sending request for 40 rows only.
here is what i am doing.
private ThreadPoolExecutor threadPool = new ThreadPoolExecutor(poolSize, maxPoolSize, keepAliveTime, TimeUnit.SECONDS, threadsQueue);
private void getArticles() {
String[] categories = {"kids", "Boys", "Girls",
"Men", "Women"};
for(final String category : categories) {
runTask(new Runnable() {
@Override
public void run() {
Log.e(TAG, "getting articles for category : " + category);
String select = "select * from shopDatabase where category = '" + category + "' AND relationType " +
"= 'none' AND articlePushTime > '2013-04-01 05:46:03.719 GMT+00:00' AND publishDateTime > '2013-04-01 05:46:03.719 GMT+00:00' " +
" AND score > '0' order by score desc limit 40";
SelectRequest selectRequest = new SelectRequest(select);
selectRequest.setConsistentRead(true);
List<Item> articles = sdbClient.select(selectRequest).getItems();
if(articles != null) {
Logger.log("ERROR", "SQLiteActivity", "articles size is : " + articles.size() + " for category : " + category, runCount);
} else {
Logger.log("ERROR", "SQLiteActivity", "articles size is : articles.size() = 0 OR NULL for category : " + category, runCount);
}
onDownload.onDownload();
}
});
}
}
public void runTask(Runnable task) { futures.add(threadPool.submit(task)); // threadPool.execute(task); }
I tried to profile it and i found that it is taking lot of time for Unmarshalling, and for every request it is getting credentials.
log responce time:
04-05 11:39:30.724: E/SQLiteActivity(14448): getting articles for category : kids
04-05 11:39:49.914: E/SQLiteActivity(14448): articles size is : 40 for category : kids
04-05 11:39:30.754: E/SQLiteActivity(14448): getting articles for category : Boys
04-05 11:39:47.644: E/SQLiteActivity(14448): articles size is : 40 for category : Boys
04-05 11:39:48.964: E/SQLiteActivity(14448): getting articles for category : Girls
04-05 11:40:02.464: E/SQLiteActivity(14448): articles size is : 40 for category : Girls
04-05 11:39:49.924: E/SQLiteActivity(14448): getting articles for category : Men
04-05 11:40:02.724: E/SQLiteActivity(14448): articles size is : 40 for category : Men
04-05 11:40:02.664: E/SQLiteActivity(14448): getting articles for category : Women
04-05 11:40:10.024: E/SQLiteActivity(14448): articles size is : 40 for category : Women