Decision at Dubsmash about Google BigQuery, Amazon SQS, AWS Lambda, Amazon Kinesis, Google Analytics, BigDataAsAService, RealTimeDataProcessing, GeneralAnalytics, ServerlessTaskProcessing

Avatar of tspecht
‎Co-Founder and CTO at Dubsmash ·
Google BigQueryGoogle BigQueryAmazon SQSAmazon SQSAWS LambdaAWS LambdaAmazon KinesisAmazon KinesisGoogle AnalyticsGoogle Analytics

In order to accurately measure & track user behaviour on our platform we moved over quickly from the initial solution using Google Analytics to a custom-built one due to resource & pricing concerns we had.

While this does sound complicated, it’s as easy as clients sending JSON blobs of events to Amazon Kinesis from where we use AWS Lambda & Amazon SQS to batch and process incoming events and then ingest them into Google BigQuery. Once events are stored in BigQuery (which usually only takes a second from the time the client sends the data until it’s available), we can use almost-standard-SQL to simply query for data while Google makes sure that, even with terabytes of data being scanned, query times stay in the range of seconds rather than hours. Before ingesting their data into the pipeline, our mobile clients are aggregating events internally and, once a certain threshold is reached or the app is going to the background, sending the events as a JSON blob into the stream.

In the past we had workers running that continuously read from the stream and would validate and post-process the data and then enqueue them for other workers to write them to BigQuery. We went ahead and implemented the Lambda-based approach in such a way that Lambda functions would automatically be triggered for incoming records, pre-aggregate events, and write them back to SQS, from which we then read them, and persist the events to BigQuery. While this approach had a couple of bumps on the road, like re-triggering functions asynchronously to keep up with the stream and proper batch sizes, we finally managed to get it running in a reliable way and are very happy with this solution today.

#ServerlessTaskProcessing #GeneralAnalytics #RealTimeDataProcessing #BigDataAsAService

14 upvotes·1K views
Avatar of Tim Specht

Tim Specht

‎Co-Founder and CTO at Dubsmash