I'm trying to calculate throughput of http endpoint. Firstly, we need the number of http requests count for an endpoint. Do I need to store the calculated count when the server gets restarted as well?
How can I formulate the logic for calculation of throughput and the best way to go ahead?
There are some possible scenarios if you don't want to use additional tools for that purpose.
If you're interested only in counting the throughput of an HTTP endpoint and the number of users is not too big, you can save this number by logging it in a dedicated file:
Here is the logic that will increment the count of endpoint calls and rewrite the log file. You can modify this code to save the data wherever you prefer - in a database, cache, or by other means of logging: