How we built a Streaming Analytics Solution using Apache Kafka & Druid
Recently, we developed a Streaming Analytics Solution using Apache Kafka & Druid for an e-commerce website. A number of shops and individual sellers sell their products via the website. Additionally, there are users who promote products from sellers by posting images of the products(these images are back-linked to the purchase page on the website — users earn for each referral and conversions)
Our requirement was to gather all events occurring on the website and build an application to run analytics on top of that data. The application was to be used by sellers and promoters on the platform. Data was to be consumed in real time for a few reports and was also used for showing cumulative money earned.
What we explored?
Rabbit MQ + MongoDB — Push data to RabbitMQ message queues for the different types of messages — clicks, view detail, share etc. Different consumer processes will then pick up this data and push it to MongoDB.
Kafka + Druid — Use Apache Kafka for capturing all events and Tranquility Kafka to push all relevant info to Druid. This was the final tech stack that was integrated.
Apache Kafka is a distributed streaming platform. It lets you publish and subscribe to streams of records, store streams of records in a fault-tolerant way, process streams of records as they occur. Here’s a brief overview of Apache Kafka
Druid is a high-performance, column-oriented, distributed data store. It allows us to explore events immediately after they occur and ingest data in streams or batches. Here’s a brief overview of Druid Architecture
About the solution
We wrote a private Node.js module on top of rdkafka to cater to all the business use cases we had. There were three Kafka topics to which events in three main categories were pushed. Data was streamed to Druid in real-time via Tranquility Kafka and also processed by two different consumers and passed on to Payments and other services which then wrote relevant data to Druid in batches.
If you liked this article, click the👏 below, and share it with other people.
References, Credits & Further Reading
- About text for Kafka & Druid taken from https://kafka.apache.org/, http://druid.io/ & Images from Wikipedia.
- Understanding Druid Real-time ingestion
- Apache Kafka Security
- Using MySQL as metadata store for Druid
- Production Cluster Configuration for Druid
Arpit is a seasoned technologist with vast experience in leading different technology teams. Arpit also consults clients on competitive market analysis, defining MVPs, product ideation, product monetization and go live strategies.
Arpit is also interested in early-stage investments in startups in design & fashion, finance, renewable energy, space, real estate, manufacturing domain.
Arpit believes we should all contribute back to society. He has set his goals for social work in five broad areas. You can read more about the same in his blog post “Do Good, Together” on Tumblr. Arpit is interested in working with people who want to contribute towards the same goals.