Daniel Robaszkiewicz

Exploring EventStore Performance on Raspberry Pi 5

In the realm of IoT and event-driven projects, efficiently capturing and managing sensor data is paramount. There is a lot of situation where your IoT device need to save a lot of data packets in split of second to make the right decision. Some time ago I asked myself: Can I save raw data to EventStoreDB from full HD camera on Raspberry Pi, without any problem, for future machine learning? EventStoreDB, known for its robust event sourcing capabilities, offers good performance, but where are the limits? How many sensors it can handle? Should we optimize events somehow?

This post delves into the performance of EventStore DB on a Raspberry Pi 5, demonstrating its potential as a versatile data backbone for various sensors.

RaspPerformance

Test environment

  • Raspberry Pi 5

  • Raspberry Pi OS Lite (Debian Bookworm - 15.03.2024 Release)

  • Dotnet SDK 8.0.202

  • Eventstore 23.10.0-alpha-arm64v8

  • Sandisk Extreme microSDXC 64 GB 170/80 MB/s A2 C10 V30 UHS-I U3

  • Samsung 64GB microSDXC EVO Plus 130MB/s

Installation Steps

  1. Install docker from this page

  2. Install docker-compose:


sudo apt install docker-compose
      

  1. Install git:


sudo apt install git
      

  1. Create docker-compose.yaml file with this content:


version: "3.4"

services:
  eventstore.db:
    image: eventstore/eventstore:23.10.0-alpha-arm64v8
    command: --maxAppendSize=10000000
    environment:
      - EVENTSTORE_PROJECTION_COMPILATION_TIMEOUT=2500
      - EVENTSTORE_CLUSTER_SIZE=1
      - EVENTSTORE_RUN_PROJECTIONS=All
      - EVENTSTORE_START_STANDARD_PROJECTIONS=true
      - EVENTSTORE_EXT_TCP_PORT=1113
      - EVENTSTORE_HTTP_PORT=2113
      - EVENTSTORE_INSECURE=true
      - EVENTSTORE_ENABLE_EXTERNAL_TCP=true
      - EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=true
    restart: always
    ports:
      - "1113:1113"
      - "2113:2113"
    volumes:
      - type: volume
        source: eventstore-volume-data
        target: /var/lib/eventstore
      - type: volume
        source: eventstore-volume-logs
        target: /var/log/eventstore

volumes:
  eventstore-volume-data:
  eventstore-volume-logs:
   

*As you can see in docker-compose.yaml, in command, we need to add "--maxAppendSize=10000000", otherwise we cannot append event bigger than 1MB.

  1. Start EventStore DB on docker:


sudo docker-compose up -d
      

Measuring SD Card Write/Read speed

  1. To measure write speed, run:


dd if=dev/zero of=./testfile bs=1M count=1024 oflag=direct
      

  1. To measure read speed, run:


dd if=./testfile of=dev/null bs=1M count=1024 iflag=nocache,dsync
      

Running Benchmark

  1. Clone repository:


git clone https://github.com/Robakuuu/EventStoreBenchmark.git
      

  1. In the cloned repository, in a folder with a file named "EventStoreBenchmark.csproj" run :


dotnet run -c Release
      

  1. Enjoy your results!

Results:


Sandisk 64GB (70MB/s W, 90MB/s R) with projections on:

Event size
Write time
Throughput
Frequency
---------------- ms MB/s Hz
512  B 2,17 0,23 461
4 KB 2.22 1,8 450,45
64 KB 13,0 4,8 76,69
256 KB 23,765 10,52 42,08
1 MB 66,856 15 15
2 MB 130,447 15,33 7,67
4 MB 247,46 16,16 4,04
8 MB NA NA NA
HD video frame BW (0.75MB) 37,48 19,79 26,68
HD video frame Color (2.22MB) 100,52 22,13 9,95
Full HD video frame BW (1.98MB) 89,89 22,0 11,12
Full HD video frame Color (5.93MB) 289,82 20,47 3,45


Sandisk 64GB (70MB/s W, 90MB/s R) with projections off:

Event size
Write Time
Throughput
Frequency
---------------- ms MB/s Hz
512  B 1,7 0,29 592,07
4 KB 1,7 2,35 587,89
64 KB 10,8 5,77 92,28
256 KB 37,9 6,59 26,36
1 MB 42,5 23,53 23,53
2 MB 74,8 26,75 13,37
4 MB 141,9 28,18 7,05
8 MB 281,1 28,46 3,56
HD video frame BW (0.75MB) 34,56 21,46 28,94
HD video frame Color (2.22MB) 83,02 26,80 12,06
Full HD video frame BW (1.98MB) 72,28 27,36 13,84
Full HD video frame Color (5.93MB) 199,46 29,74 5,01

Samsung 64GB (30 MB/s W, 90 MB/s R) with projections on:

Event size
Write Time
Throughput
Frequency
---------------- ms MB/s Hz
512  B 2,25 0,22 444
4 KB 2,06 1,95 486
64 KB 10,8 5,79 92,7
256 KB 24,7 10,1 40,5
1 MB 76,0 13,2 13,2
2 MB 151 13,2 6,61
4 MB 309 12,9 3,24
8 MB NA NA NA
HD video frame BW (0.75MB) 47,3 15,66 21,12
HD video frame Color (2.22MB) 132,8 16,75 7,53
Full HD video frame BW (1.98MB) 118,7 16,67 8,43
Full HD video frame Color (5.93MB) 361,1 16,43 2,77


Samsung 64GB (30 MB/s W, 90 MB/s R) with projections off:

Event size
Write Time
Throughput
Frequency
---------------- ms MB/s Hz
512  B 1,70 0,29 588
4 KB 1,73 2,32 579
64 KB 9,73 6,42 103
256 KB 18,1 13,8 55,3
1 MB 55,7 17,9 17,9
2 MB 105 19,0 9,50
4 MB 201 19,9 4,99
8 MB 399 20,0 2,51
HD video frame BW (0.75MB) 44,2 16,78 22,62
HD video frame Color (2.22MB) 117,18 18,99 8,53
Full HD video frame BW (1.98MB) 103,69 19,07 9,64
Full HD video frame Color (5.93MB) 295,08 20,10 3,39
Comparison of the times needed to write depending on the size of the event: Comparisions of times
Comparison of the saving frequency of individual events of different sizes, on Raspberry Pi 5 (plot in Logarithmic Axes): Comparisions of frequencies

Conclusion:

  • Changing SD card to faster have a small, positive impact on performance.

  • The biggest impact on the result was turning off the projections

  • Saving raw data video frames on EventStore in real-time (>20fps) is only possible on HD format in 1 channel.

Liked it?