|Perl Monk, Perl Meditation|
Re: Slow startup on raspberry piby marto (Cardinal)
|on Jan 16, 2015 at 10:21 UTC||Need Help??|
PAR/pp will have a startup hit on first run as it unpacks lots of things. The Raspberry Pi is a fairly low power SoC, however there are optimisations to be made. If you are running the OS from SD card, it's going to be slow, installing the OS to a USB disk (or memory stick) is significantly faster in my experience.
Consider profiling your code, perhaps there is room for improvement (see Devel::NYTProf). In situations where hardware is 'slow' in comparison to what most people are used to, and resources are scarce performance hogs become more apparent.
I've not worked with the default installation of Raspbian (Debian built for the Pi) in some time. Here are some notes I made* a long time ago and intended to post (on the topic of Perl on the Pi). The notes are far from complete, some or all items may no longer be current, so please proceed with caution:
Recently I ordered Raspberry Pi colocation with PC Extreme (I'm sure many others will offer such deals). I opted to order a Pi and 16GB SD card through them, and have them install it in their data centre, rather than configure my own and send it to them through the post (given that at the time the available colocation spaces were limited).
Tweaking the base install
Initially I had one 256MB RAM Raspberry Pi running XBMC (via raspbmc), it's streaming audio and video (including 1080p 5.1 audio) over my network, I also have a 512MB version I'm tweaking for audio work. The base install of Raspbian (a Debian variant) comes with a window manager and all sorts of other bells and whistles that I don't need. Disk space and precious RAM can be recovered by making a few changes. Feel free to skip the section below if you're not interested in doing so, but the metrics stated here are based on this setup.
* Note: A lot of these ideas are not unique to the Raspberry Pi, you can find similar discussions on many forums. Some steps below were taken for such sources.
Warning: I am not responsible for any damage or loss of data. If you choose to follow these instructions do so in on a test system first.
Once connected to the Pi via ssh, become root:
Ensure the Pi is running the latest software:
Stop openSSH (your existing connection will remain functional)
Start dropbear at boot:
At this point test you can ssh into your pi, note that a new key will have been generated, your ssh client should warn you about this change.
Once you've successfully connected remove openSSH:
Remove extra ttys, save ~4MB:
The GPU requries at minimum 16MB of RAM to load the binary blob of propriatary firmware. Ensure that the /boot/config.txt is configured to use this minimal value:
Remove IPV6 support:
Blacklist the kernel module:
Comment out the hosts:
Reboot for some changes to take effect:
Check memory use after boot:
Update: I forgot this section.
Memory usage prior to changes:
Update: I forgot to include the pre change memory usage.