Whenever we thing of designing a system we need to understand the requirement. We need to look at existing applications in market. Application cannot be created in one night. It needs proper planning on requirement, resource availability, time duration ,funds for the project etc.
Lets talk about twitter. What is twitter?
Twitter we can say is social networking site where people communicate with each other with short messages. We call these messages as tweet. These tweets can contain text, videos, photos or links. It allows people to share there thoughts with other people.
Functional requirement:
- Tweet
- Re-tweet
- Follow
- Search
Non-Functional requirement:
- Heavy reading
- Fast rendering
- Always available
- Fast tweet
- Scalable (Number of users, Daily tweet, Monthly tweet etc.)
- Low latency
Different type of users:
- Well known people ( Celebrity, Player, Politicians etc.) They have huge followers
- Active users
- Passive users
- Online users ( Available at that point)
- Inactive/Deleted
Components that we can think off:
- Different services like
- User service to get sign up/login or get user details
- Analytics service to do analysis
- Graph service
- User live (notification) service
- Different databases
- RDBMS/No SQL
- In memory (Redis)
- Cassendra or Hbase for images
- CDN for distributing data
- Search functionality
- Elastic search
- Load balancer
- Kafka
- Used to build real-time streaming data pipelines and real-time streaming applications
System should be designed such that it is loosely coupled. Initially if team size is small, you can think of monolithic architecture but you need to keep in mind that later it will be decoupled.