Scale estimations
Data entities:
User
Id
Name
Workout
Id - PK, also idempotent key
userId - partition key
Source - App/Fitness Watch/ Native app
Type - Strength/Cardio
Intensity
TimeTaken
CaloriesBurned
CreatedAt
Goal
Id - PK
UserId - Partition key
GoalWeight
CurrentWeight
Type - lose, gain
PercentComplete
CompletedAt
CreatedAt
UpdatedAt
UserStats
id
UserId - Partition key
totalWorkout
TotalGoals
GoalsCompleted
CurrentWeight
CurrentHeight
APIs
Create workout
POST /{user_id}/workout
req - {
id - idempotent key
source,
time,
intensity,
type
}
res - { id }
Create Goal
POST /{user_id}/goal
req -
{
id,
type,
goalWeight
}
Get user stats
GET/{user_id}/stat
response -
{
userId,
totalWorkouts,
totalGoals,
GoalsCompleted,
GoalsInProgress,
}
//fetch a workout
GET /{user_id}/workout/{workout_id}
Res - Workout
Get workouts history
Get /{user_id}/workout?filters=
res - workoutList
Acts as the entry point for all client requests.
Responsibilities:
Distributes traffic across multiple instances of the Read and Write services to improve scalability and availability.
Workout Service:
Responsibilities:
Goal Service:
Responsibilities:
Stats service:
Responsibilties:
Redis:
Device Tracker Service
Kafka:
Responsibilties:
We will now deep dive into the following topics
1) Offline Sync + Idempotency Key:
2) Kafka Event delivery Consistency
How will system handle high read throuput?
Failure handling
Trade offs