- Welcome to 'This is My Architecture'.
My name is Ran and joining me today is Yehuda from Fyber.
Hi Yehuda - Hi.
- Before we get into the architecture, tell us a bit about Fyber.
- So Fyber helps mobile developers monitize from ads.
- Okay, how do they do that?
- So we do that by connecting advertisers and mobile developers.
- Okay.
- We're getting half a million ad requests each second
and we go out to advertisers and try to get ads for those ad requests.
We go out to advertisers about 15 million times each second.
which generates a lot of events.
- Okay, tell us how those events look like
and what you do with them. - All right.
So those 50 million events each second goes to our Kafka.
We have a Sparks range application which reads the data from Kafka
and puts it in S3 in bucket format.
We have Spark running on EKS triggered by Airflow
and aggregating the data, again, to S3 to a more aggregated data
and also into Cassandra and also triggers EMR
to read the data from S3 and put it into Druid.
- Okay, so that's an interesting data flow.
You're running your Spark applications on Kubernetes
that's a rather new approach.
Tell us a bit about it and what it solves for you.
- Our old approach was to run with the YARN
to run 2 machines on demand and it was not as cost effective.
And we wanted to look for a more efficient way of doing things.
So we checked how to run Spark jobs on Kubernetes,
we used EKS to make it faster, not build our own.
And it seemed to be very cost effective, very stable.
- Okay, it seems like you're using Spotinst here,
that's an AWS technology partner, what does it do for you?
- So the reason this technology is so efficient
is because its auto scaling and using spot instances.
So we use Spotinst, we have a pod of Spotinst
inside our Kubernetes cluster who listen to our metric server
and see if we need to spin more machines up or actually to reduce machines.
- Okay, so when Airflow schedules a job on EKS, a Spark job on EKS,
Spotinst actually looks at the utilization
if it needs to scale, it increases the size of the cluster
with spot instances.
- Yeah, yeah he is listening all the time.
- So auto scaling and spot instances are running with Spark on Kubernetes;
that's got to be a major cost savings, right?
- Yeah, the number is about 90% cost saving from all the setup.
- Great, sounds really good.
So, as far as I understand you have several different data sources
feeding into your dashboard -
I'm assuming due to different data structure, access patterns.
Tell us a bit about those architectural decisions that you made with those?
- So those have evolved through requirements
from our customers.
So in the beginning they were very humble,
they just wanted to see how much revenue they made the previous day,
seven days ago, 30 days ago,
and then they wanted to know some more data.
They wanted to know how much they make per country,
how much they make per application that they own,
and still Cassandra is a very good setup.
You can see a whole year of revenue in milliseconds -
Fast, cheap and very efficient.
And then they wanted more, they wanted to see,
'Okay, so how am I doing per gender, how am I doing per age,
how am I doing per creative ID, campaign ID'
and 50 other more dimensions.
So that's the challenging thing, 50 more dimensions
even if the cardinality is 10, it's 10 in the power of 50.
So, we really scratch our head and came out with Druid.
So, we have Druid with opensource called 'Pivot' in the UI;
you can drag and drop different dimensions,
and you can see your revenue per every combination of dimensions that you like.
- So those are feeding the dashboard and what about Presto?
- So we have at Fyber a billion users using our systems, so
we have a lot of data about the users.
So you wamt to see a snapshot of a billion different users
in one second, very fast, this Druid cannot handle.
Druid is very good for data series, not very good for snapshots.
So Presto is actually fit for the job and actually the people who developed it,
Facebook created Presto for exactly the same purpose -
to power their audience setup in Facebook,
So the right tool for the job. It's reading data directly from S3
because it's a database engine
and not a database per se like Cassandra or Druid
and that's that.
- Great, so I really like the fact that this architecture contains data...
a database engine like you mentioned in different databases
which are purposely built for the job
instead of kind of a one size fits all and of course
Spark and Kubernetes is the next big thing. A lot of customers like that.
It sounds great that you're doing that with auto scaling and spot instances.
Thanks very much for sharing. - Thank you for having me.
And thank you for watching, 'This is My Architecture.'