A demonstration of performing WMS tiling on a Raspberry Pi Zero 2W
It is difficult, but not impossible, to build a scientific software stack on a Pi Zero.
To rapidly render images, I chose datashader for my image pipeline.
datashaderxarraycolorcetnumpy
To get this weekend project going quickly, I used FastAPI to implement HTTP capabilities.
fastapiuvicorn
A raspberry pi zero has 0.5GB of RAM and 4 cpus.
containerdnerdctl
Example commands, they work just like docker.
# Build the image
nerdctl build -t server:latest .# Run the image
nerdctl run -d --cpus 1 --memory 250mb -t server:latest --name wmsA matplotlib contour script bench.py was optimized to draw contours.
| N images | Tile size | N cores | print_png | Artists | Elapsed(s) |
|---|---|---|---|---|---|
| 500 | 256 | 1 | Y | Contours | 15 |
| 1000 | 256 | 1 | Y | Contours | 31 |
| 1000 | 256 | 1 | Y | Filled | 32 |
| 1000 | 256 | 1 | Y | Contours and Filled | 52 |
| 1000 | 256 | 1 | Y | Filled then Contour | 35 |
| 1000 | 256 | 1 | Y | Filled then Contour w/zorder | 52 |
| 1000 | 256 | 1 | Y | Filled, Contour and Quiver | 55 |
| 1000 | 256 | 4 | Y | Filled, Contour and Quiver | 15 |
| 1000 | 512 | 4 | Y | Filled, Contour and Quiver | 48 |
| 1000 | 512 | 4 | Y | Filled, Contour and Quiver | 48 |
| 1000 | 512 | 4 | N | Filled, Contour and Quiver | 38 |
For the 1000 images at 512x512px 70MB were written to disk. Turning i/o off shaves 10 seconds off a 48 second run. The problem seems to be compute limited, not disk limited.
