0

My manager asked me how much it costs (in money, currency, $) to make a REST API request from our client application to one of our services. We do not use cloud, we have on-prem servers.

The payload size averages around 5kb, and the client app makes around 750 million requests a week.

I don't even know where to start with calculating this. Where do I look? What do I search for? How do I prove the number to him?

6
  • 1
    Probably worth noting that would be about 15TB a month, so assuming the API requests aren't evenly spaced you could pretty much saturate a 100Mbit link so depending on your Internet connection it may not be as simple as the accepted answer.
    – PeterJ
    Commented Jan 12, 2020 at 8:25
  • 1
    see Where to start?
    – gnat
    Commented Jan 12, 2020 at 8:28
  • 1
    What is this information going to be used for? How accurate does it need to be? What are the consequences of an inaccurate answer, or not giving one?
    – jonrsharpe
    Commented Jan 12, 2020 at 9:42
  • This looks like a start for an interesting question (though the original title surely attracted downvotes, I tried to fix this). However, you should really do some research on your own first and then add what you found to the question. (And sorry, I don't buy "I have no idea where to start" - you surely have at least some ideas).
    – Doc Brown
    Commented Jan 12, 2020 at 14:55
  • I assume it's one client app running on lots of clients?
    – gnasher729
    Commented Jan 12, 2020 at 18:35

3 Answers 3

1

To make such a calculation, you start by making a list of cost factors and find out the weekly costs for each of them:

  • costs for your networking provider

  • the hardware (renting price, or purchasing price divided by deprecation period, broken down to a price/week), including backup systems, backup storage systems etc.

  • costs for any software required to run the system (per week, like above)

  • costs for the personal running and maintaining the system, the software and the hardware

  • costs for the rooms where the servers are placed

  • costs for the electricity, backup tapes etc.

  • maybe some things I forgot to mention.

Now you need to analyse how each of these cost factors would reduce in case your company would - hypothetically - not offer the service any more (or "outsource" the service to a 3rd party).

The difference is the "total costs of ownership"/week of the service. Divide that by 750 millions, and you have the costs per API request.

1
  • @gregb: If this answer is not what you are looking for, consider to ask on Economics.SE instead, there are probably the experts (but avoid crossposting, so if your question cannot be deleted here because of the existing answers, flag your question for migration by a moderator).
    – Doc Brown
    Commented Jan 12, 2020 at 15:26
4

It is a relevant question when hosting on cloud which may be the reason behind the question. There it is normal for each service have a price table e.g $ 0.05 for 1000 requests or something like that.

If you are hosting on-prem the answer is amortized between the hardware. The people maintaining the hardware and the internet connection.

In other words: if no one is charging you per request the price per request the price is 0$ (+fixed costs)

2
  • updated question: we use on-prem
    – greg b
    Commented Jan 12, 2020 at 14:40
  • 1
    It is 0$/request+fixed costs Commented Jan 12, 2020 at 15:01
0

Assuming you have one client app running on 1000s of clients, making 750 million requests in total of 5 KB each. Let's say so that we have numbers, you have 25,000 client devices making 30,000 requests per week of 5KB each. Change if the numbers are different.

The first cost is the cost for the clients, which is a bit tricky. You transfer 150 MB per client per week, or about 650 MB per client per month. Ask the right department what your clients pay for mobile data bandwidth. However, my ISP had two data offers: One not enough for me, another 2 1/2 times more than I needed. I took the bigger one, so for me 650 MB per client would have zero cost. Being forced to go from the smaller to the larger deal would cost me £3 per month. With 25,000 clients that's between £0 and £75,000 per month.

Then your company pays for about 16 TB of bandwidth per month to the server. Someone at your company pays the bill and knows how much this costs.

And next there is server cost. Ask your IT guys how many servers run the server code for this app. You have about 3,000 requests per second for ten hours a day, so that might be several. Then check who in the company estimates monthly cost of a server, and you get your numbers.

Of course you would divide by 750,000,000 requests per week to get the cost per request which will be very low. I think you asks really wants to know "how much do we safe if we reduce the number of requests by 10%", or "how much does it cost to roll this out to another 25,000 users" which will be much bigger numbers.

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.