Yelp Interview Question
Software Engineer InternsCountry: United States
Interview Type: Phone Interview
On a higher level, you could talk about browser cookies, and the fact that the yelp.com server will (1) run some code like python to find information about your profile (2) which will eventually call into some database to get some information like how many friends, reviews, does this person have, whats his favorite location, etc (3) maybe to get your profile photo (if not already cached by the browser) will talk to some key value store to get photos, (like amazon AWS)
then you can ask the interviewer which part would he like more details on... I think its meant to be a conversation.
Assuming the server for yelp.com isn't in your local subnet and that you know the IP and MAC address of the gateway router:
- Anonymous December 28, 2014You send a DNS packet (a UDP packet) to your DNS server, getting the mapping of the domain name "yelp.com" to an IP address. The MAC address of the link layer header of this packet is your gateway router, which then forwards this packet to your DNS server.
If your DNS server doesn't have a cached entry for "yelp.com", it will have to iteratively query the root nameserver, TLDs, and yelp's nameserver in order to get the mapping, which it then returns to you.
Now, you need to complete the TCP three-way handshake in order to establish a connection between your computer and yelp.com You send a TCP SYN packet,wait for a SYN ACK, then send an ACK packet.
Now you can get the content of "yelp.com". You send a HTTP GET request (under the TCP protocol), and wait for the HTTP responses from yelp.com. You may get several packets due to TCP segmentation.
Feel free to correct anything if you spot any mistakes.