Top 10 Microservices Interview Questions Every Developer Must Know

Do you want to get a job as a microservices developer? And, are you looking for some practical microservices interview questions? 

If so, this article is for you, wherein you will get to know about Top 10 practical microservices interview questions around a day-to-day job responsibility of a microservices developer. You will also get an insight about how to answer them and an interviewer's perspective to the answers (something unique which you may have never seen before). Isn't that cool?

Apart from that, As a bonus, there are also 5 tricky microservices interview questions for you at the end. 

Ready? Let's get started.

Microservices interview questions

When it comes to hiring a developer for microservices, I look for practical knowledge in the candidate in comparison to the theoretical aspects. Of course, conceptual understanding is a must. On top of that, evaluating a candidate based on practical questions certainly helps to gauge the real knowledge of the candidate. It helps to determine if the candidate could be the best fit to be the part of your development team or not.

Before we start with the microservices interview questions, let us first understand the job responsibilities of a microservices developer at a high-level. Being a microservices developer, the core job responsibility would be to mainly develop the awesome API(s) for your microservices. Test them, make sure they are working absolutely fine and in case any issue comes, then debug/troubleshoot the issue and fix it. 

These are just the preliminary set of responsibilities of a microservices developer, and it is not an extensive list. There are various other aspects as well a developer would be involved in. However, to begin with, the hands-on practical knowledge around above areas, is a must, to perform your role effectively.

With that, Let us now look at some interview questions around for a microservices developer. These are very basic questions a microservices developer must have knowledge about, as per my viewpoint. 

I have tried to keep the questions list around microservices REST API development only and haven't included questions about other areas such as version control knowledge and so on.

Okay, the microservices interview questions list goes as following.

Microservices Interview Questions for Developers

Q1: Explain how you develop a REST API step-by-step.

Ans: Let’s say, if I have to develop a new REST API for getting the available items quantity from the inventory, for the given product. At high-level, I would do the following,

  • decide the appropriate HTTP method for the API,
  • determine the endpoint of the API,
  • ensure url to controller mapping is in place,
  • deploy application and make sure that the API skeleton is working fine.
  • Next, add the required business logic following the coding guidelines and project code structure,
  • add the required validations in the API,
  • add the logic to get the product inventory from data source,
  • include exception handling in the API,
  • add the unit test cases,
  • test the API

From Interviewer's Eye: From the above answer, interviewer would get to know that, you follow a methodical approach to achieve any task, wherein you do the things carefully, thoroughly and in appropriate order.

You also began to explain with an example, which shows that you know how to map business requirement technically.

You have covered that; you also follow the coding guidelines and conventions as defined for the project. This indicates that you are a process-oriented person.

You mentioned about adding validations and also about including exception handling, this shows that, you have a mindset to develop robust functionality.

Overall, first impression is good and now interviewer may ask some specific questions to gauge your knowledge a bit in detail.

Q2: When do you use HTTP verbs GET,PUT,POST,DELETE while developing a REST API?

Ans: Let’s say, we have to create API(s) to create, update, delete and view product information from the inventory. In this scenario I will use,

GET for viewing the product information from the inventory

POST for creating the product information in the inventory

PUT for updating the product information in the inventory

DELETE for removing the product information from the inventory

From Interviewer's Eye: Explaining with example is always good. Your to-the-point and precise answer with example indicates that you have strong fundamentals. Next, interviewer will try to validate your fundaments with few more questions.

Q3: What is the difference between URI parameter and Query String parameter?

Ans: Okay, Let me explain this with an example.

api/product/{productname}/items, here productname is a URI parameter.

api/product/items?productname=mobile, here productname is a query string parameter.

From Interviewer's Eye: Perfect, you explained it clear-cut and pretty-well.

Q4: How do you return error response and valid response from the REST API?

Ans: For returning valid response, will use 200 status code. For returning error, will use the appropriate status code, such as, if product is not found in the inventory, return 404 error. If some unhandled exception occurs, return 500 error and so on.

From Interviewer's Eye: Good, basics are clear. Now, the interviewer will try to evaluate you based on some practical aspects.

Q5: You have developed one REST API as a part of your microservice, Built it, deployed it on local machine. Now, how do you test the REST API on your local machine?

Ans: I generally use postman to test the API once the application is deployed either locally or on server. Also, I include unit test cases as well during the development of the REST API.

From Interviewer's Eye: You know what you do. That is really good.

Q6: REST API is deployed on the dev server and has been integrated with the UI. Now, if required, how will you debug the REST API call from UI?

Ans: We can use developer tools and find out the network call to the API. For example, in Google Chrome, with F12 we can launch the developer tool. Then from Networks tab, we can filter out XHR requests and look at request/response for any API URLs. After capturing the required information about request payload, will further look at the logs to find out what’s going on and will also debug through the code, if required with the given request payload.

From Interviewer's Eye: Again, with this answer, you indicated your step-by-step approach towards debugging/troubleshooting. Also, you showed that you have in-detail knowledge about how to do that.

Q7: How do you authenticate a user for accessing the REST API?

Ans: We use bearer authentication tokens and pass them as request header to the API request.

From Interviewer's Eye: Just to check at high-level, if you are aware about API authentication and its relevant details or not.

Q8: What is Filter/Middleware? In which scenario, it would be used?

Ans: Filter/Middleware can be used to add any additional logic before or after the API controller gets executed. For example, if we want to enforce authentication, authorization prior to executing the API, it can be done with the help of Filter/Middleware. Another example could be to log the entry and exit of the API execution or measure the time.

From Interviewer's Eye: Your answer indicates that, you have good knowledge around the overall concepts of API(s).

Q9: What is the difference between logging and tracing in microservices? Which tools do you use to see them?

Ans: With trace, it is possible to track the complete request in order to see the execution path of an API. We generally track it based on the correlationid. In such case, even if a request span across multiple apis as well, it is possible to view the complete execution trace. We have used Jaeger (or any other tracing tool) tool.

Logs are a handy reference for debugging/troubleshooting. We use Elastic-Logstash-Kibana for logging.

From Interviewer's Eye: Cool, you nailed it. Not everyone is able to answer this as expected.

Q10: What is swagger? What is the use of it?

Ans: Swagger provides a nice UI showing the available APIs for the microservice. It also provides a capability to try and execute an API. We also use it as a handy reference when we have to work with other teams such as documentation and so on.

From Interviewer's Eye: Perfect, you seem to be a good fit to have you on team as you know how to effectively work with other teams and how to present your microservice to external world.

That’s the end of our Top 10 basic microservices interview questions for developers.

As I mentioned in the beginning, there would be 5 bonus questions at the end. Here you go.

Microservices Tricky Interview Questions for Developers

Q11: How do you make your REST API is backward compatible with the new releases?

Q12: Is a REST API Synchronous or Asynchronous?

Q13: What is a Health Check API in microservices?

Q14: Does the REST API Controller be singleton or per request?

Q15: What best practices you follow while developing REST API?

I have not included the answers and interviewer's perspective for these. If you are interested to know the answers, do drop me an email at techfundas.in@gmail.com. I will try to respond at the earliest possible.

Something very Important

Being a veteran in the field of software industry for more than a decade, I would certainly want the microservice developer in my team to at-least have the in-depth knowledge around the above microservices interview questions. 

Although, these questions would help you get prepared for the job interview, however, this is not an extensive list of questions and the actual questions asked in the interview may possibly be completely different. Hence, just don't use the above questions as your only source of preparation.

Along with microservices interview questions, if you want to evaluate yourself about your DevOps knowledge, it would be a good idea to go through the list of Top 60 DevOps Interview Questions as well.

If you found this article useful, do share your thoughts and feedback at techfundas.in@gmail.com. Also, do share the questions you were asked at your microservices job interview. I would love to read them.

Thank you for your time reading this article. Best wishes for your interview.