Gmail is having 5000+ mails and to fetch all the mails via JavaMAil API (i.e. folder.getMessages() ) it took around 20 seconds. I am just getting mail headers via FetchProfile a