找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 16621|回复: 3
收起左侧

System Design Interview总结

[复制链接]

2

主题

1

精华

26

积分

新米人

Rank: 1

积分
26
发表于 11-13-2015 02:57 AM | 显示全部楼层 |阅读模式

亲!马上注册或者登录会查看更多内容!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
转载一个非常不错的system design interview总结,我从中受益匪浅,求精。

SYSTEM DESIGN PREPARATION
  • How to prepare and answer system design questions:
Objective
I collected and studied from a lot of links while preparing for interviews this year and realized that unlike coding questions which has plenty of good repos and combined resources , system design remains elusive. People end up reading from scattered resources and might get pigeon-holed into studying one specific domain and get tongue tied when answering such questions. Hence I collected these links and design techniques for interviews , thought I should share with everyone If you are already familiar with the basics ( given below) it will take you ~2 months to gain a strong foothold over such questions . If you have much less time , scroll down to the bottom for the tl;dr version
IndexWhere to start from?
For a very broad overview please go through these lectures , really useful:
These talks should give you decent ammo to start formulating some architectures yourself .
Basics
But before you begin , here are some topics(in no particular order) which in my opinion you should have a decent idea of before proceeding.
  • Operating system basics: how a file system , virtual memory , paging , instruction execution cycle etc work (For starters silbershatz should be enough , if you already have decent knowledge try stallings book on OS)
  • Networking basics : Should know the TCP/IP stack , basics of how internet , HTTP , TCP/IP work at the minimum . cs75 on youtube (1st lecture ) should give a broad overview . I personally love networking-a top down approach .
  • Concurrency basics : threads , processes , threading in the language you know . Locks , mutex etc .
  • DB basics: types of DB's (sql vs no sql etc ),hashing and indexing , EAV based dbs . Sharding , caching for dbs , master slave etc
  • A basic idea of how a basic architecture is , say load balancers , proxy , servers , db servers , caching servers , precompute , logging big data etc. Just know broadly what is each layer for.
  • very basic summary of what the CAP therem is (Have never been asked about the theorem itself , but knowing it will help you in designing large scale systems.
How to answer in interviews
  • I found hiredintech videos an excellent place to start with . The way how to approach a design question as given in the link is really useful . It goes into how we start with clearing the use-cases of the system , then thinking in abstract manner of the various component and the interactions . Think about the bottlenecks of the system and what is more critical for your system ( eg latency vs reliability vs uptime etc) Address those giving the tradeoff of your appraoch.
  • system design in crack the coding interview : good approach on how to begin attacking a problem by first solving for a small usecase then expanding the system .
  • The best way to prepare for such questions is do mock interviews , pick any topic (given below) try to comeup with a design and then go and see how and why it is designed in that manner. There is absolutely no alternative to practice!! Whiteboarding a system design question is similar to actually writing code and testing it ! Just reading will only take you so far.

Steps how I approach the system design questions in interviews
These are the steps I go through mentally in the interviews , followed by actual interview experiences:
  • a) Be absolutely sure you understand the problem being asked , clarify on the onset rather than assuming anything
  • b) Use-cases . This is critical , you MUST know what is the system going to be used for , what is the scale it is going to be used for . Also constraints like requests per second, requests types, data written per second, data read per second.
  • c) Solve the problem for a very small set, say 100 users . This will broadly help you figure out the data structures , components , abstract design of the overall model
  • d) Write down the various components figured out so far and how will they interact with each other.
  • e) As a rule of thumb remember atleast these :
    • 1.processing and servers
    • 2.storage
    • 3.caching
    • 4.concurrency and communication
    • 5.security
    • 6.load balancing and proxy
    • 7.CDN
    • 8. Monetization : if relevant , how will you monetize? eg . What kind of DB (will mysql do ? or nosql fits btr? ) , do you need caching (almost always !) and how much , is security a prime concern?
  • f) Special cases for the question asked. Eg say designing a system for storing thumbnails , will a file system suffice ? What if you have to scale for facebook or google? Will a nosql based db work?
  • g) After I have my components in place , what I generally try to do is look for minor optimization in various places according to the usecases , various tradeoffs that will help in better scaling in 99% cases .
  • h) Scaling out or up
  • i) Check with the interviewer is there any other special case he is looking to solve ? Also it really helps if you know about the company you are interviewing with , what its architecture is , what will the interviewer have more interest in based on the company and what he works on ?
Common Design questions
It generally depends what you are and you will be working on . Also what your level is but these are some of the more frequent interview questions .
  • Design amazon's frequently viewed product page (eg. which shows the last 5 items you saw)
  • Design an online poker game for multiplayer . Solve for persistence , concurrency , scale . Draw the ER diagram for this
  • Design a url compression system
  • Search engine ( generally asked with people who have some domain knowledge ) : basic crawling , collection , hashing etc. Dependes on your expertise on this topic
  • Design dropbox's architecture . good talk on this
  • Design a picture sharing website. How will you store thumbnails , photos? Usage of CDNS? caching at various layers etc .
  • * Design a news feed (eg facebook , twitter ) : news feed
  • Design a product based on maps , eg hotel / ATM finder given a location.
  • Design malloc , free and garbage collection system . What data structures to use? decorator pattern over malloc etc
  • Design a site like junglee.com i.e price comparision , availability on ecommerce websites. When and will you cache , how much to query , how to crawl efficiently over ecommerce sites, sharding of dbs , basic db design
  • A web application for chatting , eg whatsapp , facebook chat . Issues of each , scaling problems , status and availablility notification etc.
  • Design a system for collaberating over a document simulataneously (eg google docs)
  • (very common top 'n' or most frequent items of a running stream of data
  • Design election commission architecture : Let's say we work with the Election Commission. On Counting day, we want to collate the votes received at the lakhs of voting booths all over the country. Each booth has a voting machine, which, when connected to the network, returns an array of the form {[party_id, num_votes],[party_id_2, num_votes_2],...}. We want to collect these and get the current scores in real time. The report we need continuously is how many seats is each party leading in. Please design a system f rthis
  • Design a logging system (For web applications, it is common to have a large number of servers running the same application, with a load balancer in front to distribute the incoming requests. In this scenario, we want to check and alarm in case an exception is thrown in any of the servers. We want a system that checks for appearance of specific words, "Exception", "Disk Full" etc. in the logs of any of the servers. How would you design this system?)
Architectures :
Personally I looked into the following architectures:
company engineering blog links
courtesy checkcheckzz
Depending on where you are interviewing , go through the company blog . VERY USEFUL IN INTERVIEWS! It really helps if you have an idea of the architecture , as the questions asked will generally be of that domain and your prior knowledge will help out here.
Low on time ?
I would HIGHLY recommend you dont take a shortcut unless you have a week or so for an interview . System design is best learnt by practicing , shortcuts might help you in the short term , but would recommend coming back to this link for an indepth understanding after the interview
  • a)Go through cs76 and udacity's links given above for scaling systems.
  • b)Go through the engineering blog of the company you are interviewing in (or if its a startup go through the link of the company closest to yours)
  • c)See this talk : http://www.hiredintech.com/system-design/the-system-design-process/ and develop a process for how to answer such questions .
  • d) remember these terms , just roll over them in your interview in your mind , and if relevant mention it in the interview
    • processing and servers
    • storage
    • caching
    • concurrency and communication
    • security
    • load balancing and proxy
    • CDN
    • Monetization

Best of luck
发表于 11-13-2015 11:28 PM 来自美国米群网手机版 | 显示全部楼层
感谢您的面经分享~~~祝您面试工作学习顺利~~~大米积分满满送上~~~
回复 支持 反对

使用道具 举报

6

主题

0

精华

52

积分

资深会员

Rank: 2

积分
52
发表于 11-21-2015 03:00 AM | 显示全部楼层
收藏了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表