X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=src%2F_posts%2F2016-02-10-light-in-realraum-is-now-faster.md;h=df16292ac3b60dcee7ddeba5036e47150f0bdeac;hb=HEAD;hp=0ca8dd915bc8eccbcac2b8aa8a518e79ddbb9bb7;hpb=afbb02fc33e2a7afc03c52d3293778510394b57e;p=homepage.git diff --git a/src/_posts/2016-02-10-light-in-realraum-is-now-faster.md b/src/_posts/2016-02-10-light-in-realraum-is-now-faster.md index 0ca8dd9..df16292 100644 --- a/src/_posts/2016-02-10-light-in-realraum-is-now-faster.md +++ b/src/_posts/2016-02-10-light-in-realraum-is-now-faster.md @@ -26,20 +26,20 @@ categories: - english - Projekte --- -[licht.realraum.at](http://licht.realraum.at "licht.realraum.at"), went FTLw today. That is… it became much Faster Than Last week. :-) +[licht.realraum.at](http://licht.realraum.at "licht.realraum.at"), went FTLw today. That is… it became much Faster Than Last week. :-) Since the Raspbian image upgrade and move to a bigger (but slower) SDcard, licht.realraum.at had become truly sluggish. To the point that pressing a button to turn on the light or change the stereo volume could take up to 6 seconds until something happened. (Obviously we disabled the swap-file long ago.) -The problem was quickly identified. Processes don’t load quickly enough. +The problem was quickly identified. Processes don’t load quickly enough. The fact that the whole systems was a dunghill of bashscript cgi-scripts and python helper scripts also did not help. At all. **First attempt** to rectify this: rewrite the python helper rf433ctl.py. Formerly it was a simple script that would be called by the cgi-script and send the appropriate bytes down to the teensy. -Each call to it, however now took forever. So. I rewrote it as a daemon that would constantly stay in memory and be nudged by other instances of it via RPC. The idea being, if it’s already completely in memory, loading a second instance should be faster. Right? Wrong!. Unfortunately that did not work out at all. +Each call to it, however now took forever. So. I rewrote it as a daemon that would constantly stay in memory and be nudged by other instances of it via RPC. The idea being, if it’s already completely in memory, loading a second instance should be faster. Right? Wrong!. Unfortunately that did not work out at all. **Second attempt** to rectify this: Remove the kiosk functionality and thus memory-hog midori from licht. Thankfully a very nice person gifted us a RaspberryPi per (almost) anonymous letter, so we had the necessary hardware on-hand to split the functionality onto two separate boxes: [`licht.realraum.at`](http://licht.realraum.at "licht.realraum.at") and `smallkiosk.realraum.at` Unfortunately, even freeing up 60% of memory did not even put a dent into the problem. -So.. **third and last attempt**. Hit it with go ;-> In a 3 hour session, I rewrote the whole dunghill as a [monolithic golang daemon/webserver/tty-handler](https://github.com/realraum/deckenlichtschalter/tree/master/linux/golightctrl) which, once loaded, always stays in memory. Then I got rid of lighthttpd and the python scripts. Result… Speedup from 6s to <=0.05s !! Should have done this right away really… \ No newline at end of file +So.. **third and last attempt**. Hit it with go ;-> In a 3 hour session, I rewrote the whole dunghill as a [monolithic golang daemon/webserver/tty-handler](https://github.com/realraum/deckenlichtschalter/tree/master/linux/golightctrl) which, once loaded, always stays in memory. Then I got rid of lighthttpd and the python scripts. Result… Speedup from 6s to <=0.05s !! Should have done this right away really… \ No newline at end of file