سؤال

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?

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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)

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى softwareengineering.stackexchange
scroll top