Nowadays nobody will ask you to design systems with limited number of users , always expectation would how you design highly available , partition tolerant , horizontally scaling secure cloud application .
Gone are the days , when interviewer was asking to design chat server which works in one JVM process for two users .
Now people need to start thinking laterally about highly scale-able, distributed, parallel algorithms and how scale only by adding more hardware for dynamic load .
This fact is more essential now a days because architecture remains same for single user or millions of users , only difference is number of machines handling them in background .
Pre-requisite :
- Design patterns
- Distributed Systems
- Cloud Platform - AWS/OpenStack/Azure
- SQL/NO-SQL databases for big data , Tuning consistency in NO-SQL
- Map-Reduce - Hadoop/Apache Spark/ZooKeeper
- Micro- services architecture
- Rule /workflow engines
- Information retrieval - (Elastic search /Solr)
- Shared nothing architecture
- Synchronous systems (queue based producer /consumer) - P2P
- pub-sub models
- Caching (Write-through , Write-back , Write-around , eviction policies ) - Memcached, Redis
Design Goals -
- Reusable , Extensible design
- High performance ( Acceptable SLAs , Storage )
- High Availability
- Partition Tolerance
- Handles big data
- Security
- Scale linearly (vertical and horizontal ) with more hardware .
General aim is throw ambiguous questions to candidate and see how he can navigate through open ended scenarios . How he asks questions , how he create use cases , how he consider performance , scale , security and SOLID principles to design .
Such questions are suitable for Face to Face interview or given offline tasks with sufficient time. It is not suitable for telephonic interviews .
Approach
Top to bottom approach
Macro Level -
- Build basic use cases and in-variants .Understand success/warning/failure cases .Write down use cases one by one . Ask questions for scenarios using Ws like What, Who, When , Where , Why and also How.
- Understand broad level independent logical modules /packages/micro-services .
- Identify main entities /interfaces /classes in the system. Understand segregated interfaces . Do not one fat interface .
- Understand basic actors in the system .
- Draw component /class /object /package diagram .
- Anticipate changes in future requirements like if some things are not dynamic today , those could be dynamic in future , adding similar type of specialized functionality etc.
Micro-Level
- First do all interface based design , for all major classes (DAO classes , Coordinator classes )
- Consider design patterns if applicable , do not over use them to show your knowledge .
- Think multi-threaded approach with compute intensive / IO intensive activities .
- Understand basic tasks and separable boundaries so that you can create distributed processing of item .If task is fully independent then it will be helpful to use distributed computing - Map-Reduce .
- Externalize configurable parts like rules engine , thread-pool sizes in JSON , property file , XML etc.
General Questions
1. Design Coffee Machine
2. Design lift system for a multi-storied building
3. Design Chat Server (typical pub-sub problem)
4. Design distributed cache
5. Design traffic signal system
6. Design bus/train scheduling system
7. Scheduling meetings with given number of meeting rooms.
8. Design online shopping site .
9. Design tiny URL system .
10. Do some kind of analytics on text for large number of files (typical Map-Reduce problem).
11. Design restaurant reservation system .
12. Design restaurant system with rule based pricing and dynamic configurations for menu items .
13. Find connected components in large data . (say you have excel-sheet with some king of graph structure ).
14. Design Search Engine .
15. Design twitter
14. Design parking lot system.
15. Design custom re-entrant lock
16. Design custom thread pool.
17. Design Object thread pool or JDBC connection thread pool.
18. Design distributed file system.
No comments:
Post a Comment