2

My apologies if this is the wrong stack exchange site for this question. Please, let me know if I should ask this in a different place.

I have recently went to a interview. The interview was for the position of senior full stack engineer. At that interview, I was asked the question:

How would you design a scalable web application

While the question focused on scalability, it was meant in the sense of a modern, responsive application.

I will try to reproduce the answer I gave as best as possible.

I was told that my answer, while it have some good points, was not exactly what they would expect, and that it was closer to the answer they would expect from someone applying for a mid level position rather then a senior one.

I am curious how my answer can be improved.

The answer:

Well, there are three things to consider, the frontend, the backend and the data base. Since I am mainly experienced with React, Django and MongoDB, I will assume these technologies.

Beginning with the frontend, I would be serving a html file with a javascript bundle. Since we want to minimise the size of the bundle, to get it across as fast as possible, I would see if there are libraries we can do without or where we can only import partially. For example, loadash allows partial imports, to avoid bundling the entire library. I would also be cautious how many requests I make to the backend and how much information I retrieve at one time. If we had to display a very long list of items, I would go for a infinite scroller strategy rather then trying to fetch all data at once. Another thing I would look at is using something like rselect in order to minimise the number of computations we do when the dom tree re renders.

Moving to the backend, we would have a RESTful architecture. Our Django views would be mapped to different methods and endpoints and their role would be to communicate with the data base. I would use mongoengine rather then the lower level pymongo. We couldn't have only one server so I would deploy this under a load balancer. Another thing I would ensure is we serve everything over https. I would redirect all http traffic to https, in order to improve security.

Coming to the database, we would need a cluster, in order to be able to scale horizontally. In order to optimise performance I would index the database. Additionally, I would ensure we had different machines used for reading and writing, in order to distribute the load more evenly.

What are the most important things to mention when it comes to scaling regarding each of the three components of the stack?

Other then scaling, what are the other features of modern web application?

What is a complete and thorough answer to this question?

closed as too broad by gnat, JacquesB, EL Yusubov, Kilian Foth, TheCatWhisperer Feb 5 '18 at 14:53

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I don't think this is really answerable - we don't know what cues the interviewers were looking for. The subject is far to vast to give a "complete and through answer". – JacquesB Feb 2 '18 at 8:54
  • @JacquesB i see what you mean, and I agree. I was looking for feedback more, because like I said, they told me it's a mid level answer. I was trying to see what I was missing, not necessarily in detail but the thing it's self so I can research it further. – mayk93 Feb 2 '18 at 16:02
1

To my point of view, you are too fast going into some details. I would outline an answer as follows:

  1. Mention the need for scalability and what does this means? Increasing the number of people using the site as a need? With the consequence that response time etc (so called qualitites) should not change (much)? This would imply that you build up a scalable architecture.
  2. Scalable architecture means that you may add elements (software, servers) in such a way that you still maintain the desired and perceived quality attributes (such as the above mentioned response time).
  3. Then, you may show a scalable architecture, we 1..n layers and 1..m servers per layer. (see, just as one example, https://www.guru99.com/n-tier-architecture-system-concepts-tips.html
  4. you should show the implication of larger queries, implication of peaks of access etc onto this architecture
  5. Finally, you could go into examples such as you are mentioning. Normally, when you have done point 4, you will be asked for details somewhere.

Relating to the input question "How would you design a scalable web application" - responsiveness has not much to do with scalability. What you could mention is the usage of libaries on the client side that dynamically load results from the webservers.

Not the answer you're looking for? Browse other questions tagged or ask your own question.