node.jsnginxraspberry-piraspbiantiddlywiki

Node.js app takes a long time to start up and connect to? Why?


I have this app I'm developing and I thought of moving the VM I was using to real hardware. My Raspberry Pi 2 came to mind, a quad-core 900mhz ARM v7 with 1GB of ram. This hardware clocks at twice the speed I set my VM to run (a typical low end VPS equivalent) so it should be more than enough.

Installed Raspbian, nginx and the nodejs package from their repository using apt-get. Everything is super! But I noticed this distinct slowness when accessing the app. It's like a 7-10 sec pause before everything loads.

To test it further I installed full-fledged Node.js app called Tiddlywiki which I installed and used many times in the past. And it's true, there it was again that 7-10 sec delay when you refresh the page.

The app seems to run fine, POST and GET is instant once it's up and running in the Web Browser, but the delay is there if I refresh the page.

NOTE: If I restart the Pi and wait for it to restart the first time I access the app URL the delay seems to double, about 15 sec. Nginx html pages seem lightning fast in comparison.

Any thoughts on this?


Solution

  • Apparently Node.JS apps are quite fast on the Raspberry Pi 2. The app I was test driving had and still has some weird behavior when using a password to encrypt content and starting the server with --password 12345678 made everything run very slow.

    Running the app without a password is lightning fast.

    PS. The app in question was Tiddlywiki, which can be run as a server for collaboration and such.