2

I would like to roughly check if the code I plan to run on a RPi stresses it in a reasonable way (CPU, RAM, disk).

I was wondering if there are some "throttled down" Debian VMs which could be used (ideally with Virtual Box) for such tests?

Notes:

  • I know that there are many parameters which need to be taken into account to closely simulate a system on another one (starting with x86 vs. ARM). I am trying to roughly estimate how the RPi is going to behave before pushing the code on it (specifically in the case I am making major changes and do not want to rollback all the time)
  • I am not looking for emulation of a RPi - at least not in the sense that I want to test cross processor code. I know that my code will run, I am not just sure if the RPi will follow.
  • this is in the context of amateur coding
  • an equivalent of this in the context of network would be to use tc to simulate the bandwidth/packet-loss/latency.
WoJ
  • 545
  • 2
  • 6
  • 15
  • 1
    Given the price point of the Pi wouldn't running this on a real Pi make for better data and easier/faster testing easily offestting the cost of the Pi. Also, what does "this is in the context of amateur coding" even mean? – Steve Robillard Jan 12 '16 at 14:07
  • In addition to what @SteveRobillard says, consider this: to make a RPi VM, I'm going to need performance data to see if my VM more-or-less matches the performance of a real Pi. So I'm going to be sitting at my desk, tinkering with the settings of the VM, with a real RPi sitting next to me for comparison. Spending hours on this seems like a waste of time when I could just use the hardware sitting next to me. – Kryten Jan 12 '16 at 14:12
  • AFAIK Qemu is really not that fast. Especially the Windows builds i've used in 2012 matched the single-core models in their lacking performance nicely ;-) – flakeshake Jan 12 '16 at 14:12
  • 1
    @SteveRobillard I don't think some people are willing to buy a pi simply to test some lines of code, especially if the code is made on a whim. – Aloha Jan 12 '16 at 14:12
  • @PandaLion98: why not? As SteveRobillard points out, they're not expensive. Plus, if the OP's project DOES work out, he's gonna want to run it on a Pi, so he's going to need to buy one... – Kryten Jan 12 '16 at 14:14
  • 1
    @SteveRobillard: the context (amateur) was there to indicate that I am not developing a life-sustaining application. Just a simple home automation system, in my spare time. I have a RPi and, sure, could buy a second one but it is much easier to work with a VM. – WoJ Jan 12 '16 at 14:15
  • Apparently Qemu is 50% slower . If your software runs nicely on that , have no fear taxing an 2012 Model B : https://raspberrypi.stackexchange.com/questions/333/how-does-speed-of-qemu-emulation-compare-to-a-real-raspberry-pi-board?rq=1 – flakeshake Jan 12 '16 at 14:15
  • 1
    @WoJ Why not test it on the pi? It's way more effective than any simulation. – Aloha Jan 12 '16 at 14:17
  • @Kryten: I have two of them, they are both used at the moment. I do not want to test on them because they are in "production". I am now sitting at my desk wondering "will redis work fast enough?" and a VM would help. – WoJ Jan 12 '16 at 14:17
  • @WOJ That may be true, but at the price point of the Pi these decisions don't make economic/logical sense. What is your time worth. What might emulating or modeling the Pi not tell you - that you only find out when using the real thing. Modeling/Emulating are no guarantee of real world performance oe suitability. – Steve Robillard Jan 12 '16 at 14:17
  • Given the number of home automation projects in the wild and the fact that at least one book has been written on the subject. The Pi is obviously suited to this type of application. So, I fail to see the advantage of modeling/emulation. Added to that you already have two Pi's so would only need to buy the board itself (if you really don't want to take an existing project down for a day or two). – Steve Robillard Jan 12 '16 at 14:21
  • @SteveRobillard: "The Pi is obviously suited to this type of application". A backend web server in Python + redis + a web browser running js - can you positively confirm that a RPi is enough for that? Without knowing the load of the webserver, the RAM taken by the in-memory DB and the load of the JS? At that point obviously suited becomes Finally I do not know and this must be checked. – WoJ Jan 12 '16 at 14:24
  • I am not saying not to check I am saying that your proposed method will not guarantee an answer. Can you guarantee that an emaulated or modeled scenario will prove the feasbility of the system – Steve Robillard Jan 12 '16 at 14:25
  • 1
    @SteveRobillard: no, this is why I am looking for a approximate perspective. If it exceeds the RAM then I know this is not good. If it generates a load of 15 then I know that this is not good either, etc. At least I would have an idea. – WoJ Jan 12 '16 at 14:34
  • And if it says it should be OK but turns out that it can't keep up after you bought the Pi - what have you gained? As you already own two Pis you can run the test once save a load of time and have better data. – Steve Robillard Jan 12 '16 at 14:36

1 Answers1

3

QEMU is 50% slower than even the oldest Raspberry Pis from 2012.

Suffice to say , if your code works fluently inside QEMU , it should perform better on a real Pi.

flakeshake
  • 6,235
  • 1
  • 14
  • 33