Skip to content

Data pipeline design review (kinesis firehose -> s3 -> redshift serverless)

0

Hi, I would be interested by a design review to see if what I am targeting makes sense.

Questions

  • Does this design make sense?
  • Would you recommend a better way?

High-level goal of the solution

  • Store in a redshift serverless cluster events published by services
  • One redshift table per event_type
  • These events will later be used for analytic

Solution (see flow diagram below)

  • (1) Services publish json events through a Kinesis Firehose
    • All events will share a common attribute: event_type
  • (2) Firehose will be configured to:
    • Partition events on event_type
    • Store events in a s3 bucket with a dedicated directory per event_type
  • (3) On every file created in the s3 bucket:
    • A Lambda will be triggered
    • The Lambda will determine the target table based on the directory of the file (one table per event_type)
    • The Lambda will COPY the entries from the files into the target table

Expected volume

  • Around 20 different event_type
  • Around 10 different attributes per event_type
  • Around 20k events published per event_type per day
    • Except for 3 event_type, for which we can expect around 7 millions of events per day per day per event_type

Requirements

  • Delay between events published in firehose and events available in the targeted redshift table should ideally be below 5 minutes

Enter image description here

  • Note that firehose automatic writes to redshift charge rpus, your pricing may end up being higher than you expect. Maybe consider using a tiny provisioned cluster for the writes and data sharing to a more powerful serverless instance to do the occasional query crunching. That’s the point of serverless, when it only needs to be used a few times a day, not have a query run against it every 5 minutes consistently.

asked 2 years ago516 views

3 Answers
0

Your design is good. Check on the following recommendations for better performance.

Consider Using Redshift Spectrum:

For very high volumes of data or if you anticipate a need to query the raw event data in S3 without immediately loading it into Redshift, consider using Redshift Spectrum. This allows you to query data directly in S3 without needing to load it into Redshift tables.

Evaluate Kinesis Data Streams:

If you anticipate needing more real-time processing or complex event transformations before loading data, consider using Kinesis Data Streams with Kinesis Analytics or Lambda, instead of directly using Firehose.

Consider using AWS Glue:

AWS Glue could be used to catalog your data in S3, making it easier to manage the schema and potentially providing more flexibility in how you load and query data in Redshift.

AWS
EXPERT

answered 2 years ago

0

Redshift is great at loading fewer large files (in MB's or GB's) compared to many small files (in kB or B's). So I can recommend that you leverage the data lake as much as you can first. Keep all your data in S3 layer. For query purposes leverage the Redshift compute via external tables, pointing to the S3 locations directly, querying in-place without need to ETL into Redshift. This will help you achieve near real-time, your less than 5 mins requirement, basically you can query the data as soon as it is available on S3. For truly realtime requirements you can leverage Kinesis family of services.

Secondly, do consider some sort of S3 file compaction process, maybe end of day, to combine thousands of small files into a fewer but larger files. This will help manage your data lake and also will help with query performance irrespective if you use Redshift or Athena or any other compute.

And finally, work backwards from your analytical query needs. Not everything needs to go to Redshift storage, use it for your most performance demanding queries. For relaxed SLA's even Amazon Athena could suffice.

For deeper understanding of this approach kindly refer to white paper "Storage Best Practices for Data and Analytics Applications" sections "Data lake foundation" at https://docs.aws.amazon.com/whitepapers/latest/building-data-lakes/data-lake-foundation.html , and section "In-place querying" at https://docs.aws.amazon.com/whitepapers/latest/building-data-lakes/in-place-querying.html

Best of luck and feel free to join the AWS Developers community slack channel #amazon-redshift to discuss directly with fellow Redshift developers, use https://join.slack.com/share/enQtNzYzNjEyNDM4OTY4Mi03OWVhODQ3YzQ4OTlkZmI2YTdhMjYyZjUwNzM3NmQwODU5MWI1YTg2MTM5YWY1ZTg4OGNmZGE3YzljOGMxMzVl

Note that this link will remain active for 14 days.

AWS
EXPERT

answered 2 years ago

0

Your pipeline design with Kinesis Firehose, S3, and Redshift Serverless is sound but can be improved.

Consider partitioning data by date or time, batch processing files to reduce Lambda overhead, and evaluating alternatives for high-volume data loading.

Ensure robust error handling and performance monitoring to meet your latency goal of under 5 minutes, especially for high-volume event types.

https://sequencediagram.org/index.html#initialData=CoSwLgNgpgXABAEQIZiXACiADlCIB2UcAylAI4CuU+AxkQiEgOYBOSAtgFCdZItgga2JPjAkoLAG6CoAZx58BQ3qLgBpAnJCyAYiBZQAFgHtZUBf0HDVxAMwWl1sQBkOAIwAmSB1ZViASlAesoYgAGZgpFIS0LLynFHSdLIAtAB8GoSy2noGJmbw6BRueCFwAFLEAPIAcnBQktRgsnAAFA1NAPpgAJ44AJScmVq6+kamUOl28MRgxgb1jaItrbyWAsaEHnBuPYtdvQMJtumu7J5I8MAsIExMEnCbcIQA7nBhINBwNAYoIJucM4XKa2eCBJDbDqqD5fVpuJBmbZPDxjGhzFg9AD0ULA3T6UEGQK86UCwVCEUSMTksngAGEqugAJpwLyoOAEOZwVAse5iVAlIhwhFBR74faiPFHUkhcKRCSNFixVJpImXOAAQRoAGt8MYXtAPPcWSg0BBjBDOEA

EXPERT

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.