Amazon Interview Question for SDE-2s


Team: android amazon app, social shopping
Country: United States
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

Let's start with definition what is "push notification". We can define it as "A push notification is a message delivered by a centralized server to an endpoint device." In our case the endpoint device is an android device. Then we need to figure out how a device will receive a message. One of the simple approaches could be to open socket to listen messages from server when the device is up. It may be performed by system or a special system application. So the device tries to reach server by general DNS name like push.android.com. Initial requests to open connection goes through load balancer and is delegated to one of servers behind balancer. That will help us to extend number of servers to support more clients without affects to architecture. There are connection timeout handlers, we can assign to this handlers initialization of connection. Thus if a server is down all its client will get event that connection is closed and it leads to new establishing of connection again though the load balancer. It is worth also to support redundancy for load balancer level.
Now it is time to discuss what is 'a message'. Nowaday this is usual thing to base the message format on XML or JSON. Cons of this approach in comparing with binary format is increasing of data transfer size, but because it is not anticipated to have long message this should be OK.
The last question is a conception of guarantee delivery. By default we include guarantee delivery in scope that means if a server gets down or a device is not available then we don't send notification although a client of your push notification solution sends notification. This is not so good. To resolve this case we should introduce persistence layer to keep messages and delivery statuses. When a client of our push notification solution initiates sending a message we create a row in DB. Then the server which is responsible to send message for the specified device pick up the row and tries to send it to device and is waiting for acknowledgement. When acknowledgement is getting back to the server it updates row to reflect successful delivery.

- igor.s.sokolov June 22, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

hi guys,

I am newbie here. Does design here also means class diagram for the same?

- abhi June 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@igor great answer. do you think a token bucket algorithm on the load balancer would be beneficial?

- addy June 25, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

test              tet

- Anonymous February 23, 2020 | 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