I got an opportunity to work extensively with Big Data and analytics in Myntra. Data-driven intelligence being one of the core values at Myntra, crunching and processing data and reporting meaningful insights for the company is of utmost importance.
Every day, millions of users visit Myntra on our app or website, generating billions of clickstream events which makes it very important for the data platform team to scale to such a huge number of incoming events, ingest them in real time with minimal or no loss, and process the unstructured/semi-structured data to generate insights.
We use a varied set of technologies and in-house products to achieve the above including but not limited to Go, Kafka, Secor, Spark, Scala, Java, S3, Presto, and Redshift.
As more and more business decisions tend to be based on data and insights, batch and offline reporting from data were simply not enough. We required real-time user behavior analysis, real-time traffic, real-time notification performance, and other metrics to be available with minimal latency for business users to make decisions. We needed to ingest as well as filter and process data in real-time and also persist it in a write fast performant data store to do dashboarding and reporting on top of it.
Meterial is one such pipeline which does exactly this and even more with a feedback loop for other teams to take action from the data in real time.
Meterial is powered by:
1. Apache Kafka.
2. Data transformer based on Apache Spark.
3. MemSQL real-time database.
4. React.js based UI.
Our event collectors, written in Golang, sit behind Amazon ELB to receive events from our app and website. They add a timestamp to the incoming clickstream events and push them into Kafka.
From Kafka, a Meterial-ingestion layer based on Apache Spark streaming ingests around ~4 million events/minute, filters and transforms the incoming events based on a configuration file, and persists them to MemSQL the row store every minute. MemSQL returns results for queries spawning across millions of rows with sub-second latency.
Our in-house dashboarding and reporting framework (UDP: Universal Dashboarding platform) have services that query MemSQL every minute and store the results in a UDP query cache from where it is served to all the connected clients using socket based connections.
Results are displayed in a form of graphs, charts, tables, and other numerous widgets supported by UDP. The same UDP APIs are also used by Slack bots to post data into Slack channels in real time using Slack outgoing webhooks.
As all transactional data currently lies in Redshift and there are requirements where reporting of commerce data with user data every 15 minutes is needed, Meterial also enables this ad-hoc analysis on data for our team of data analysts. Every fifteen minutes, data from MemSQL for that interval is dumped into S3 from where it is loaded to Redshift using our S3 — Redshift ETLs.
We selected Spark as our streaming engine because of its proven scale, powerful community support, expertise within the team, and easy scalability with proper tuning.
For real-time datastore choice, we did POC on multiple databases and drilled down to MemSQL.
MemSQL is a high-performance, in-memory, disk-based database that combines the horizontal scalability of distributed systems with the familiarity of SQL.
We have seen MemSQL support very high concurrent reads and writes very smoothly at our scale with proper tuning.
Currently, we are exploring MemSQL column stores as OLAP DBs for our AB Test framework (Morpheus) and Segmentation Platform (Personify).
Sample UI Screenshots
Using real-time data with predictive analytics, Machine Learning, and Artificial Intelligence opens altogether new doors to understand user behavior, what paths and funnels lead to commerce, and more. Getting such information in real time can definitely help us boost our commerce and take corrective actions if something goes wrong as soon as possible. We are constantly working on improving and enhancing.