r/dataengineering • • 27d ago

Discussion Scaling IoT Telemetry Pipeline

Hi guys, I am building a data pipeline system for an IoT product which is sending telemetry data (aka measurements from different devices) Couple of thousands messages per second but expected to grow exponentially soon. Have tried to align them into a normal logical order of things which works so far

Device -> measurements(mqtt) -> consumer -> timeserial databsase (simplified)

And now I am trying to grow this thing into a bigger - more mature system where I could develop it into a good flexible data pipeline and where we can have probably 3 main outputs:

- storage (short & long term for later)

- analytics (probably from long term datalake)

- alarm detection (ideally real time)

Anyone with experience in this? I would be really happy if someone who has already built such systems can help me understand where should I look - lots of solutions out there with pros and cons

p.s. We use AWS

thx!

10 Upvotes

9 comments sorted by

1

u/uccidibuti 26d ago

Yes I do this at my work but we didn't use aws, we built all on top of mosquitto and postgres. We have also a opcua server for opc sensors. If you want know something in detail just ask me

1

u/alt_acc2020 26d ago

I’m building this rn and dealing with OPC for the first time.

Do you use telegraf or the likes to collect the data? Do you stream to Kafka / MQTT and then write to a time series db or do you directly write to your lake?

How do you deal with stale / backfill data for your sources? Does backfill data get consumed from the same topic? If you get some older data and say your sensor data is in scd2, do you recompute all affected partitions and the likes?

Re: Postgres. What are your costs like running this and what are some of your pain points? I’m quite junior in this space and need to think about rearchitecting a bunch of our semantics

1

u/uccidibuti 25d ago

Premise: our customer have from 100K to 1M sensors and a typical delay of 15 -20 minutes to see data updated in our application is acceptable.
About mqtt:
sensors publish data to a mqtt broker, we have an importer subscribed that aggregate data for sensor id and each X minutes write data to postgres. As mqtt broker we use mosquitto but if you prefer there are also other commercial alternative or cloud services.

About Opc:
We have an imported attached in monitoring, we received data and aggregate data per sensor id in ram and each X minutes we write data to postgres. If our customer have also Opc History mode actived, once a day we use it to get last 2 days of data. For our opc client we use .NET OPC Ua official sdk, it's open source. We have also an OpcUa Server still implemented with .NET OPC Ua.

About Postgres and performance:

We use postgres instead of other timeseries database because our customers have already postgres installed and we won't introduce others dependencies. We write 1 record for each (sensors_id, Day), this implies that every time you need update just one value you need to read 1 record that represent a day, append or update the value and re-write the record. For this reason, all the write operations we perform are made by chunks. For our solution the bottleneck is writing data (typical 1-5 minutes every time new data arrive), but query are super fast (we partiotin data by time week).

About scd2:
we have timeseries metadata table and timeseries data table. If we want update metadata sensors we just add new metadata record (we don't change timeseries data).

1

u/alt_acc2020 26d ago

This is exactly what I work on day in and day out. And I’m probably dealing with the same challenges you are, would love to connect!

0

u/[deleted] 26d ago edited 26d ago

[removed] — view removed comment

1

u/dataengineering-ModTeam 26d ago

Your post/comment was removed because it violated rule #9 (No AI generated content/text).

Your post/comment was reviewed to be AI generated/assisted content/text and removed as a result. We as a community value human engagement and encourage users to express themselves authentically.

This was reviewed by a human

0

u/[deleted] 25d ago

[removed] — view removed comment

1

u/dataengineering-ModTeam 25d ago

Your post/comment was removed because it violated rule #9 (No AI generated content/text).

Your post/comment was reviewed to be AI generated/assisted content/text and removed as a result. We as a community value human engagement and encourage users to express themselves authentically.

This was reviewed by a human