Post/get request with HTTP package very slow

I am using the meteor HTTP package to do a post request to the last.fm API. Somehow all the request take rather long to complete. Meteor takes between 700ms to 1200ms to complete the request.

This is the code I am using:

let res = HTTP.post(LASTFM_ENDPOINT, {
            params: {
                method: "user.getrecenttracks",
                format: "json",
                user: lastfmname,
                api_key: LASTFM_CLIENT_APIKEY,
                from: 0,
                to: to,
                limit: 200,
                page: 1
            }
        });

I also tried a get request… It had similar reponse times.

Any ideas why this takes so long? When I do the same request using NodeJS http it completes almost instantly.

I tested on my dev build. Google.com took 130ms. last.fm took 800-1200ms, but that was their full homepage. I then tested on a random small image from last.fm, and that took 100-250ms

(This is what I did)

Meteor.setInterval(function(){
  let time = new Date()
  HTTP.get('http://www.last.fm/static/images/defaults/player_default_album.430223706b14.png')
  console.log('time',new Date() - time)
},1000)

Thanks for your quick reply! I did exactly the same tests you did, in a Node environment and Meteor environment and got exactly the same response times. So I was wrong in the first place…

The reason why I thought Node was outperforming Meteor JS is because in Node multiple calls are executed async, which means it appears as if it is completing calls more quickly, but in fact it is doing multiple calls simultanuously…

I am going to try and perform multiple http requests in Meteor without waiting for the result of the request before starting the next.