Each time a user of my APP / website interacts with the APP such that it makes an API call to the backend, the backend will make an API call to the mongoDB database to retrieve the document that holds this user's data. This user object currently sits at:

9871 bytes, which is roughly 10 KB.


Is this scheme scalable? Would it be able to handle millions of users?

  • 2
    Have you tried benchmarking it? Are you likely to have millions of users?
    – pjc50
    Commented Oct 20, 2023 at 15:26
  • What is in this user object, and why is it necessary? If it is security-related, then how much is securing your application worth? Commented Oct 20, 2023 at 16:57

1 Answer 1


You are likely not even measuring the thing you really want to measure.

When looking at the "Is this scalable" question, you need to look at cost per user or cost per request.

For example, you say "Every time my app interacts with the website, it transfers 10k" (paraphrased). Well, how many times does that happen? 1 million users, * 10,000 = about 1 gig.

If that's once a day, then sure you're fine. If that is 30 times a second, well, even that could be okay if each user is worth $100 a day.

As programmers, we tend to think of "scalability" in terms of hard limits. Data * ram * users <=> Server's Ram. And that is one aspect. You obviously don't want each request to be larger than the amount of RAM on the machine. However, when you talk about real scalability, you really need to consider cost and not the limits of the machine (unless you hit a brick wall).

Can each request send 50 gigs of data a second to each user? Sure, it can be done. Are you (and the user) going to want to pay the cost to do that? Probably not.

As a good rule of thumb, I would default to transferring as little data as I could. Maybe a session id or a user id. Then, build out from there if needed. Know and generally track your cost per user and your "budget per user". If a user is worth $7.00 a day, you don't get all of that. Some go to advertising, some to support, etc.

Then look at whether you can afford to send 10k per interaction.

Try to also keep in mind that it may be cheaper to send 10k per transaction by throwing money at the hardware side, then to pay devs to shave 10k to 5k per transaction.

Unfortunately, "Is it scalable" is a hard question to quantify, and even harder to answer. While I would never recommend ignoring the question, I would generally advise that it's the kind of thing that you need to address when you are trying to scale, and not when you are trying to build.

After all, you will have many more options when you have 1 million users paying $19.95 a month, than you do when you have 5 users and someone bankrolling the project on their home equity line of credit.

  • 1
    This is a good perspective. What’s missing from this analysis is the cost of improvements. Developers can easily cost you more than users. There’s also pressure to be first to market making development time more important to optimize than performance. Commented Oct 21, 2023 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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