75 lines
2.9 KiB
Markdown
75 lines
2.9 KiB
Markdown
# solar-server Benchmarks
|
|
|
|
Comparing a NodeJS REST API using ExpressJS and a file based logging solution against a Pistache REST API using an Sqlite3 logging solution. Measurements are made with Firefox, server is a Raspberry Pi 3 with all content stored on a microsd card (slow!). See the conclusion at the end if you want a TLDR;.
|
|
|
|
## Raspberry Pi Model 3 B Benchmarks
|
|
Iteration #1: Fetching stuff from the database on a day by day basis (1 day = 1 query)
|
|
|
|
| Operation | NodeJS | Pistache | Difference |
|
|
|-----------|-------:|---------:|-----------:|
|
|
| Day | 11ms | 6ms | -5ms |
|
|
| Month | 38ms | 80ms | +80ms |
|
|
| Year | 2122ms | 3353ms | +1231ms |
|
|
|
|
Iteration #2: Fetching stuff from the database in a single query for all requests
|
|
+ Index on DateTimeUtc
|
|
|
|
| Operation | NodeJS | Pistache | Difference |
|
|
|-----------|-------:|---------:|-----------:|
|
|
| Day | 12ms | 16ms | +4ms |
|
|
| Month | 40ms | 127ms | +87ms |
|
|
| Year | 1281ms | 6143ms | +4942ms |
|
|
|
|
Iteration #3: Tweaks
|
|
+ Index on KilowattHour
|
|
+ Reindex
|
|
|
|
**No difference**
|
|
|
|
Iteration #4: Split DateTimeUtc into separate TEXT columns
|
|
|
|
| Operation | NodeJS | Pistache | Difference |
|
|
|-----------|-------:|---------:|-----------:|
|
|
| Day | 10ms | 18ms | +8ms |
|
|
| Month | 34ms | 45ms | +11ms |
|
|
| Year | 1151ms | 2110ms | +959ms |
|
|
|
|
## Pentium G5400 Benchmarks
|
|
|
|
Iteration #5: Hardware change (Raspberry Pi 3+ to Pentium G5400)
|
|
|
|
| Operation | NodeJS | Pistache | Difference |
|
|
|-----------|-------:|---------:|-----------:|
|
|
| Day | - | 3ms | - |
|
|
| Month | - | 5ms | - |
|
|
| Year | - | 83ms | - |
|
|
|
|
Iteration #6: Keep a separate summary table
|
|
|
|
| Operation | NodeJS | Pistache | Difference |
|
|
|-----------|-------:|---------:|-----------:|
|
|
| Day | - | 3ms | - |
|
|
| Month | - | 1ms | - |
|
|
| Year | - | 4ms | - |
|
|
|
|
Comparison to the raspberry pi running the same software:
|
|
|
|
| Operation | RPi | Pentium | Difference |
|
|
|-----------|-------:|---------:|-----------:|
|
|
| Day | 14ms | 3ms | -11ms |
|
|
| Month | 5ms | 1ms | -4ms |
|
|
| Year | 16ms | 4ms | -12ms |
|
|
|
|
## Conclusion
|
|
|
|
Clarification:
|
|
- All platforms run Debian Buster
|
|
- RPi = Raspbery Pi Model 3 B+
|
|
- NodeJS = NodeJS Express.js server serving the solar logs stored as file per day (/var/log/solar/[yyyy]/[mm_dd].txt)
|
|
- Pistache = Pistache server serving the solar logs stored in a SQLite3 database
|
|
|
|
| Operation | RPi NodeJS | RPi Pistache | Pentium G5400 Pistache |
|
|
|-----------|-----------:|-------------:|-----------------------:|
|
|
| Day | 11ms | 14ms | 3ms |
|
|
| Month | 38ms | 5ms | 1ms |
|
|
| Year | 2122ms | 16ms | 4ms | |