Thursday, October 10, 2019

Designing Distributed Systems Useful Links

Distributed Systems Useful Links
Below are some of the links to the different technologies which are used to build a distributed system. It is necessary to know the different technologies available and how they can be used to build a distributed system.

Topics to Discuss for System Design Interview
Whenever you are Designing a System the following things should be discussed.
  1. What is the problem Statement
  2. Requirement and Goal of the System?
  3. Functional Requirements
  4. Non Functional Requirements
  5. Some Design Considerations
  6. Capacity Estimation and Constraints
    • Traffic Estimate
    • Storage Estimate
    • Bandwidth Estimate
    • Memory Estimate
  7. High Level Design
  8. System API
  9. Database Design
  10. Load Balancer
  11. Caching
  12. Disaster Recovery plan
Keep the following things in Mind and call the following things during the interview to show that you have a deep understanding of the concepts
  • Load Balancer and usage
  • CAP theorem - Will you choose Consistency or Availability ?
  • Multiple instances of the service
  • Software Architectural pattern for used
  • Microservices Architectural pattern used
  • Discuss Databases
    • Type of database used - NoSQL vs SQL and why ?
    • Do we need DB Sharding?
    • Do we need Consistent Hashing ?
    • Master - slave architecture
    • Will Read and Write happen from same DB ?
  • Discuss Caching
    • Caching strategy - DBs that can be used for Caching
    • Cache eviction policy
  • Discuss Queueing mechanism
    • Kafka, RabbitMQ
  • Discuss Disaster Recovery
    • How multiple instances could help 
    • How DB backups can be made

Service Registry

Rabbit MQ:


Video : 



KAFKA vs RabbitMQ



JMS vs RabbitMQ:







Capacity Estimation

Design a Job Schedular


Design a Job Schedular


A job scheduler to schedule M jobs on N threads on a single machine. The input contains the following data:
  1. Job Name
  2. Duration: time taken for job completion
  3. Priority: priority of the job. P0>P1>P2
  4. Deadline: Expiry time after which job should not be run (The clock starts from 0 and deadline is the actual clock time)
  5. UserType: Type of user who has initiated the job, Precedence of users Root>Admin>User
Shortest Job First – SJF : Shortest job first (SJF), is a scheduling policy that selects the waiting process with the smallest execution time to execute next. In case of tie choose the job according to the following order-
  1. Priority(higher priority job gets scheduled first)
First Come First Serve -FCFS : Jobs are executed on first come, first serve basis. Take the input as the order of jobs need to be scheduled.
Fixed Priority Scheduling -FPS : Each process is assigned a priority. Process with highest priority is to be executed first and so on. In case of tie choose the job according to the following order-
  1. User Type
  2. Longest Job First
Earliest Deadline First – EDF : Next job will be searched on the basis of job which is closest to its deadline. In case of tie, choose the job according to the following order-
  1. Priority(higher priority job gets scheduled first)
  2. Duration(lesser duration job gets scheduled first) In case we cannot schedule a job such that it completes before its deadline then it should be ignored.
You would be given a list of jobs (refer example below for format) and number of threads as input. You are expected to print the order of jobs scheduled for each algorithm on each thread as output.
Input
Threads= 2
JOB NAME
DURATION
PRIORITY
DEADLINE
USER TYPE
J1
10
P0
10
Root
J2
20
P0
40
Admin
J3
15
P2
40
Root
J4
30
P1
40
User
J5
10
P2
30
User
Output
SJF
Thread 1 - J1, J3, J4
Thread 2 - J5, J2
FCFS
Thread 1 - J1, J3, J5
Thread 2 - J2, J4
FPS
Thread 1 - J1, J4, J5
Thread 2 - J2, J3
EDF
Thread 1 - J1, J2
Thread 3 - J5, J4

From <https://www.geeksforgeeks.org/flipkart-interview-experience-sde-1-experienced/>


AWS Useful Links

Behavioural/ Open ended Question


Behavioural or open ended questions are often asked in an interview. These questions are asked to evaluate the thought process of the candidate. It is necessary that you prepare well for these questions since these questions decide if you would be a good cultural fit for the company.

Prepare answers for these questions and practice answering them as you would in an interview. Even if the questions are not the same you would have thought through different scenarios which you would have faced and would be able to give those examples while answering the questions.

Another tip is to use S.T.A.R (Situation Task Action Result) method to frame your answer so that you are able to conclude on the answer without beating around the bush. 

Following are some of the behavioural Questions that get asked in different rounds of the interview.
  • Why you want to leave your current company?
  • Why you want to join XXX company?
  • What is the most complex problem you have done till now?
  • If you get magic stick, which engineering problem would you like to solve ?
  • What you would like to improve in you?
  • Single word which describes you?
  • How will you define a bad programmer and a good programmer ?
  • What is need to design a good system ?
  • How you ensure you are solving your daily coding problems in best way?
  • How do u handle disagreement with manager 
  • What is the size of the team and composition of team (technology wise) you are handling ?
    Sample Answer - I am currently managing a team of 8 members. There is one Senior Software Engineer, 2 Associate Senior engineer, 4 Software Engineers and a Test Automation Engineer. All the engineers work on various technologies - Java, C#, Angular JS, React JS, Restful Web Services and the Test Automation Engineer works on Manual Testing as well as testing automation via EggPlant.
  • What is your participation level in technical discussion / How would your typical day looks like ?
    Sample Answer - As the projects gets onboarded to the team I have discussion with the product managers to understand the needs of the project. I am responsible to decide the technical feasibility of the project and the technology stack to used to implement the project. I come up with the high level and detailed level design for the project. For the software engineers I provide the low level design for the task provided to them. My role in the technical discussions is the ensure the proper design for the problem is being considered, performance is considered, future extensibility is kept in mind as well as to make sure new changes are not going effect the existing users.
    On a typical day I do code reviews for the team, resolve any technical challenges that the team members are facing, having design discussions with the team on the iteration work, having design discussion with other stakeholders on the next set of projects, investigate client issues and provide short term and plan for long term fix.
  • Are you involved in code review ? Are you hands on with any programming language
    Sample Answer - On a daily basis I go ahead and do code reviews for the team. I am the primary gatekeeper for the projects getting merged to the master and being released to the clients. I am hands on with Java programming.

  • What are the stakeholders with whom you interact and Frequency ?
    Sample Answer - I have interaction with the Lead Senior Engineering Manager, product manager, project manager and US counterpart team. I meet with the Lead Senior Engineering Manager once a week, with product manager every alternate week, on a daily basis with the project manager and weekly with my US counterpart. Apart from this we have biweekly Client calls where we demos for the capabilities developed.
  • Have you worked on microservice architecture or any cloud based product?
    Sample Answer -  Yes I have worked on microservice architecture. I have implemented multiple microservices and few of the microservices are deployed in the cloud as well. 
  • How do you handle low performing associates?
  • How do you set goals for your team?
  • How do you set goals for yourself?
  • How do you handle conflicts between employees?
  • How do you mentor your engineers? What is your mentoring style ?
  • What do you look for when hiring an engineer?
  • What do you do to build the team?
  • How do you keep the team motivated ?
  • How do you drive culture cross your team ?
  • How do you help new associate fit into the current team ?
  • What are the Que's for re-architecture?
  • Metrics Ownership

Engineering Manager Reads


System Design

System Design
System design is key in Senior Engineering interviews. Following are some of the good resources to prepare well for the system design interview questions


Below are some additional System Design Questions which have appeared in different company interviews


Table Booking System

Design a table booking system.
Expectations :
  • System design
  • Class Diagram (UML diagram )
  • Flow / Seqence diagram

From <https://www.geeksforgeeks.org/interview-experience-at-flipkart-sd-ii/>


JIRA like System

Design a system like Jira. It should have the following functionalities :
  • User should be able to create Task of type Story, Feature, Bugs. Each can have their own status.
  • Stories can further have subtasks.
  • Should be able to change the status of any task.
  • User should be able to create any sprint. Should be able to add any task to sprint and remove from it.
  • User should be able to print
    • Delayed task
    • Sprint details
    • Tasks assigned to the user

From <https://www.geeksforgeeks.org/interview-experience-at-flipkart-sd-ii/>


Design Swiggy.

HLD and LLD
Major focus on data modeling and API design. High level discussion on system design and components to be used.

Twitter Design



From <https://www.geeksforgeeks.org/flipkart-interview-for-sde-ii/>

Offer Ride System

Design offerRide and shareRide mechanism on basis of fastest and earliest ride
Create a application that will add user and add their vehicle, there will be two categories one who is offering ride and other who is selecting ride.
In offer ride(user_name, vehicle_no, origin, destination, start_time, duration)
select_ride(user_name, origin, destination, parameter)

parameter is fastest ride which will be on shortest duration and earliest ride will be lesser start_time+duration.


Design Book My Show

Elevator Design

Other Reference Documentation

AWS Cloud Practitioner Essentials