Amazon Interview Question for Software Engineer / Developers


Team: Amazon Video
Country: UK
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
1
of 3 vote

Let us start designing the system.
What is the functionality we need to support:
1. Post Messages on a Topic
2. Show All Messages under a Topic.
3. Search for a Topic
There can be other features, but let us restrict ourselves to these core features. We can always extend later.
What are our Entities?
1. Topic 2. Messages 3. Users.
Ok, Is this a Write-Heavy system or a Read Heavy System? I would say, read-Heavy ( Reads should be around 10/100 times more than writes- new posts would be not as frequent as post reads). From Scalability purpose, how do we scale our DB. We can use a MySQL DB with a Single Write Master and Multiple Read Slaves for scaling. This would hurt consistency - some users may not be able to see certain posts, but we should be fine with that at the cost of high availability. The problem here is that single master may not be enough , since our writes are also reasonably high. So, a sharded architecture would be preferrable. Should we shard using user_id, or post_id? Post_id should be preferred, so that all messages of a post go to same shard. We would use consistent hashing to distribute the posts to the shards, so that adding/removal of shards does not cause a problem.
Caching - We should cache the recent messages of each post and the recent posts- so that they can be fetched directly from cache, and do not need to hit the DB. We should use a separate Memcache/Redis Cluster for the Cache. This would be a write-Through Cache, so the recent posts would be written to the cache, and the cache would write to the db. This process should actually be asynchronous. When the user posts a message, we should push that to a message queue like SQS/Kafka and later consume these messages to write to the cache and then the DB.
MicroServices - We would ideally like to break out into multiple Services like ReadService and WriteService, so that they can scale separately. Distributed Transactions would be a challenge here, we should aim for eventual Consistency

- 4d August 21, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Halo,


In total awe…. So much respect and gratitude to you folks for pulling off such amazing blogs without missing any points on the #topic. Kudos!

I joined the Amazon affiliate site and received my access key id and my secret key.

There was a problem downlaoding and saving the secret key so I created another one.

I am submitting this information to Amazon to complete my affilaite site but Amazon is accepting the information.

I would appreciate any information as to why this may be ocurring.




I look forward to see your next updates.


Kind Regards,
Irene Hynes

- Irene Hynes June 11, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

In This mapping will also play a important role like As rsumanKumar mentioned that we need the entities like Topic, Message, User and Manager so mapping should be like Topic to Message have one to many mapping, Message to user have one to one mapping and user to Manager have many to one mapping.

- Kapil July 27, 2017 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More