Twitter streaming seems very slow on my Heroku app


#1

I have developed a very simple Node.js app to stream tweets into MongoDB.
On my localhost, I am collecting dozens of tweets per second (tracking the words “love” and “hate”).
But when I deploy to Heroku, I’m lucky to get one per second.
Is the Twitter streaming API somehow rate-limiting the Heroku IP range or something?
Because to my knowledge, I personally haven’t done anything unusual that would merit my app slowing down that much.
Please advise, as my company is planning to use this app for several projects in 2014.

You can visit this URL and refresh to see how often new tweets are being added: http://pulse3.herokuapp.com/twitter

Thanks,
–brad g.


#2

Are you reading from the streaming API in the same process as you’re interpreting it? It’s possible your consumption is just slower than the stream you’re receiving, causing it to perceptively “slow down.” Try making sure that the process responsible for receiving the data is decoupled from any process queue that works with the data. It’s also a good idea to use stall_warnings=true when connecting and looking for messages that indicate you’re being stalled due to not being able to keep up.


#3

Thanks. I just console logged a bunch of stuff and was able to pinpoint the problem to a MongoDB quota, not the Twitter API.