2

I´m running a Raspberry Pi Model B (512MB RAM) with a 16 gB 300MB/s SD-card and recent raspbian with all updates.

On this machine I´ve set up a apache2-server, node.js with socket.io and firmata.

Within my web-application, video streaming is a key feature.

When I access my webserver just for streaming the videos (without node/socket.io/firmata), everything streams with a good performance. But when I switch on node.js/socket.io/firmata it's rather slow, it takes 5-7 seconds to start streaming the videos.

I had problems installing node.js in the first place. Node.js from source compiled/installed like a charm, but when I tried to run it, I got this mysterious "Illegal instruction" message.

As an alternative I took the precompiled debian-packages and installed them using dpkg using this repo:

http://revryl.com/2014/01/04/nodejs-raspberry-pi/

They say that nodejs will run slower, but that´s not acceptable for me.

Any hints?

Thanks and regards!

goetzmoritz
  • 453
  • 1
  • 5
  • 23
  • you use `socket.io` to stream videos? maybe thats the problem try https://github.com/nkzawa/socket.io-stream or http://binaryjs.com/ to stream. – Gntem Apr 11 '14 at 09:39
  • If you don't need so much cross platform support there are fast implementations of web sockets than socket.io for node. Such as WS. – Ross Apr 11 '14 at 09:41
  • nah, it's about multiple iPads that use socket.ioo communicate with the server. The iPads fire a certain event when reaching a time code in each video. On a windows-server this runs in realtime, but not on the raspberry. – goetzmoritz Apr 11 '14 at 22:20

1 Answers1

0

Allright, it´s faster now. For everyone with this issue:

  • Dispose apache2 and use lighttpd instead. Just check out this page and see why: http://www.jeremymorgan.com/blog/programming/raspberry-pi-web-server-comparison/
  • Start node.js via script and put into /etc/rc.local Out of some reason it uses much less RAM and CPU when in idle.
  • Try to avoid firmata. If you need to control hardware that requires simple wiring, try to use the "pi-gpio". It´s MUCH faster and uses less resources. Also you don´t need your arduino anymore as you can use only the rpi.
goetzmoritz
  • 453
  • 1
  • 5
  • 23