How to find the blocking code?

I’ve got a fairly complex meteor app that’s having a performance issue. I’ve gone through the code attempting to find where the issue is and what I’ve found is a that executes on the server at a certain time but for which the callback isn’t called for another 15 seconds.

I’m assuming this is because there’s some other blocking code running on the client that’s keeping the framework from getting to the callback. But how do I find it? I can step through everything else that’s happening on the same path that the was made on, but there’s a lot of code. Is there something in particular I might look for or some technique/tool that folks recommend?


Nah… If the client page was frozen for 15 seconds, maybe that would be the case. But you would have noticed if the website was that busted much sooner.

On the heavyweight side, turn on the Kadira-based APMs. On the lightweight side, just try commenting out calls to Mongo collections, one at a time, until the method performs quickly. Besides serious coding errors (which again, would be obvious), the collection calls are often a culprit. Writing them better / correctly will fix an issue.

If the client really freezes or becomes unresponsive for that long, and you don’t want to install the Kadira APM, simply measure the amount of data transfer in your Chrome Tools tab during the execution of the method. If a lot is being transferred, you’re probably sending a large number of large documents, which takes no time to download but lots of time to deserialize and render.