Automatically translate this page?
9 July, 2020

Estimating the storage required for your device messages

How much flespi storage will your telematics project need?

flespi Terms of use page contains one seemingly simple line — "Storage: $1 per 1 GB". In most flespi use cases, this storage is used primarily for device messages, which often leads to the logical question “How much flespi storage do I need for device messages?”. The plausible answer is usually impossible without answers to the following additional questions:

We need to estimate the number of parameters in each message so we ask:

  • which device types do you use?

  • are devices connected to CAN-bus?

  • do you have many sensors tied to the device?

We need to estimate the number of messages sent per day so we ask:

  • how precise must the track be?

  • how frequently does the device send messages?

  • how intensively is a vehicle with the tracker used? (e.g. daily mileage)

And finally, we need to understand what you need to do with this data so we ask:

You get the idea, but not an answer :) In this article I will try to benchmark flespi device message storage based on the simulated data from the real device. In the first part, I take the Teltonika FMB110 device installed in my car to check how tracking settings affect the number of messages per km and per hour for city and highway driving. In the second part, I will compare the number of messages per 1 MB of flespi storage depending on the device type (number of parameters per message). These two steps will provide us with an algorithm of flespi storage estimation: you input the requirements of your project and get an approximate but reasonable number.

Messages per km and per hour

The benchmark shows valid results when we measure the change in the target parameter while controlling for all insignificant parameters. Almost every GPS tracking device has settings that allow adjusting track accuracy — a telemetry message can be generated on timeout, on distance change, on angle change, and on speed change. These are variable parameters. The more messages the device sends, the higher the traffic consumption. But this article is not about how to define optimal tracking parameters. 

To account for traffic and route differences I picked two geofences on the way from home to work: highway (21 km) and city (2 km) without traffic lights. How do we count the number of messages per geofence? Using flespi analytics of course.

flespi calculator number of messages

Simple expression “1” counter with the “summary” method applied will count the number of messages. Mileage and duration of the interval can be used to determine the number of messages per kilometer and per hour.

Here are the results of my test:


Precise

Moderate

Sufficient

Poor

Timeout (s)

30

60

150

300

Distance (m)

100

250

750

1500

Angle (deg)

10

20

30

45

Speed (km/h)

10

15

20

25

Msgs per KM (highway)

9

4

3

1

Msgs per Hour (highway)

757

334

193

87

Msgs per KM (city)

22

14

13

11

Msgs per Hour (city)

889

443

410

403

messages per hour chart

messages per kilometer chart

How to use these numbers? 

Examples:

Task 1 

Given:

  1. daily engine hours — 8.

  2. the device is tuned for Moderate track quality

  3. city/highway ratio is 70%/30%

Solution:

(334 * 30% + 443 * 70%) * 8 hours = 3282 messages daily ~ 100K messages monthly

Task 2

Given:

  1. weekly average mileage is about 1K kilometers

  2. the device is tuned somewhere between Moderate and Sufficient track quality

  3. vehicle mostly rides down the highways

Solution: 

Interpolate the number of messages per kilometer for the city — 12 and for the highway — 2. Let’s assume that the city/highway ratio is 10%/90%. Thus

(2 * 90% + 12 * 10%) * 1000 = 3K messages weekly ~ 13K messages monthly

Ok, but what do these numbers tell me? Welcome to the next chapter.

Messages per MB

flespi storage is a real work of art. But this article is not about its architecture but about numbers: the number of messages per MB or the average size of a message in bytes. 

The number of kilobytes shown on the device card can be obtained in the device messages_size field via REST API or as a retained message via the topic flespi/state/gw/devices/169791/messages_size. But how to obtain the number of messages? flespi analytics helps. The same expression “1” counter and interval selector that is true for each message would give the number of stored messages per device. 

Note that some system parameters are registered in each message even if the device itself sends just one simple sensor value. These system parameters include channel.id, device.id, device.type.id, device.name, ident, protocol.id, server.timestamp, timestamp. So the smallest possible message will consist of nine parameters.

Device type

Parameters in message

Amount of messages per MB in flespi storage

Approx message size in bytes

Simple sensor

9

6432

155

Position only

15

3937

253

Tracker (no CAN-bus)

28

3076

326

Tracker (with sensors)

40

1811

552

message size vs number of parameters

How to use these numbers? Let’s look at some real-life examples:

Task 3

Given:

I have a fleet of 200 vehicles from Task 1 above, each generates 100K messages monthly, and the number of parameters in the message is ~ 25. How much will I pay for flespi storage if I store the messages history for half a year?

Solution:

25 message parameters can be interpolated to 300 bytes per message.

300 bytes * 100K * 6 * 200 / 1GB = 33.5 GB. This will incur an additional storage fee of $33.

Task 4

Given:

I have a fleet of 1000 vehicles from Task 2 above, each generates 13K messages monthly, these are full-featured trackers connected to CAN-bus and different sensors, each message contains ~37 parameters. I don’t want my storage bill to be more than $10/month (which means no more than an extra 10GB of storage). How long can I store the messages history? (read: what messages TTL should I set for devices?)

Note: each device in the Commercial account has 10GB of message storage.

Solution:

10GB / (500 bytes * 13K messages * 1000 vehicles) = 1.65 month = 50 days.

Set messages TTL to 50 days and feel safe about your monthly storage billing.

***

As you can see, there are a lot of moving parts in the calculation of storage required for your telematics device messages. This article helps you estimate how many megabytes your trackers will generate in a month, and how this number depends on the reporting frequency, the number of parameters in the message, and other project needs. Hope this will give you a clearer understanding of what adjustments can be made to optimize the final figure and fit it into your budget.

P.S. We are going to release an interactive “Estimate my project” calculator soon to help you make informed business decisions when evaluating flespi as a foundation for your project.