Tracking Logged on Users
On a project I'm building for a client, one of the requirements is advanced user tracking. The client would like to know what pages an authenticated user is visiting, and when. I read through this post, which is probably the method I will go with. However, that seems a bit tolling on the database, and being that the client may use Azure to host this, I would like to keep the # of db transactions to a minimum [although this was not one of his requirements... just a favor i guess :) ]. Anyway, I'm torn between the following two methods... please advise what you all feel is best and what the pros / cons of either method might be. Or suggest an开发者_如何学JAVAy alternative methods I may have missed.
- Method One: Log to db on every HTTP request using a HTTP module
- Method Two: Store in visits in session and log everything to database in one swoop during Session_End event
Premature optimization is the root of most evil. I would personally say option 1, since it should be the simplest to implement.
For your own satisfaction, you might consider the cost of a database hit, how many you're already making during a request, and then how many you would be expecting to get, say, per day. (And then compare it to how much your time costs...)
From glancing at the Azure stuff, it appears that the cost will be negligible unless you end up with a titanic amount of traffic. I can't really understand what the charts mean, but I'm assuming the cost is either 15 cents per gigabyte of transfer, or a 14 GB block of transfer per month, which really is a lot in terms of sending database rows.
精彩评论