Bandwidth monitoring in asp.net

Hi, We are developing a multi-user application in Asp.Net with a separate database for each tenant, in which one of the requirements is to control the use of bandwidth for each tenant,

I tried to search, but did not find much help on this topic, we want to precisely control how much bandwidth is used for each tenant, while each tenant can have its own top-level domain or subdomain or a combination of both.

So what are the options available, the ones I can think of may be

  • IIS log monitoring means a separate application that will calculate the throughput for each tenant.
  • Log each request and response for the tenant from the application, and then calculate the total bandwidth usage based on this.
  • Use some components of the third part, if available.

So, what do you think will be a better approach, also if there is any other way to do this.

+4
source share
3 answers

Ok, here is the idea (that I am not testing, leave it for you)

In global.asax, use one of these functions (find one that has a valid final size)

Application_PostRequestHandlerExecute Application_ReleaseRequestState 

and get the size you sent using

 Response.Filter.Length 

No measurement needed to get call file name with

 HttpContext.Current.Request.Path 

These functions are called with every single request, so you can get your size and you do the rest.

It should be noted here that you need to check this idea first to see if its work is working and possibly improve it, and I have that if you are compressing pages on the server, the length is wrong and maybe you need to compress its on Global.asax to have the actual length.

I hope for this help.

+6
source

Well, since the IIS logs already contain the request size and response size, it doesn't seem too complicated to develop a small tool to analyze them and calculate the total per day / week / month / independently.

0
source

Trying to segment host-based traffic is difficult in my experience. Instead, if you give each tenant their own IP addresses for applications, you can find programs that will control IP-based bandwidth.

APPENDIX Is your IIS structure one website to manage them all for all tenants and when you log in to the plug in the appropriate database? If this is the case, this can create version problems in that all tenant sites must have exactly the same scheme, and all of them must be updated at the same time when updating the application, so changing the scheme is required.

Another structure that sounds like what you might have is that each tenant has their own website:

 tenant1_site/appvirtualdir tenant2_site/appvirtualdir ... 

Where appvirtualdir points to the same physical path for all tenant sites. When all clients have the same version of the application, they all use literally the same code. If you have this scenario and some kind of authentication, then you will need one IP address for each tenant due to SSL. SSL will only be bound to IP and port, unlike non-SSL, which will be bound to IP, port and host. If so, then IP-based traffic monitoring will continue to be simpler and more accurate, as can be done on a router or through a network monitor.

0
source

All Articles