简体   繁体   中英

Logging & Reporting Page Views - MVC - Azure

I have an Azure Website that is predominantly used by 30 internal users. Given the nature of our business, we are required to log all data changes and views of the data (HIPAA/PHI). I'm looking for what you might call the "best practice" for implementing this to handle some significant user base growth in 2015 - 1000 users.

 `[user, datetime, controller, action, params]`

Today, we have setup an ActionFilter that is executed on specified controller actions to collect user information along with the controller and view and pass that into a SQL Azure Database. While this can execute asynchronously, the table is simply getting extremely fat. The queries against this data to show most recent 10 views for example is very slow.

I'd prefer my database not get terribly fat from transactional data like this, are we best to look at implementing this data into a DocumentDB structure?

What should we be doing for storing these page views that allow us to do the following:
1. Report the most 10 recent customer views by a user 2. Report all views for a user 3. Report all views for a customer

The answer here depends on the amount of data you're querying against.

You probably already know this... but make sure you have indexes on the fields you are querying against (date viewed, user, customer). Profile your queries to make sure you're getting index seeks rather than table scans.

If your data and usage outgrows a single Azure SQL database, you can scale-out by partitioning / sharding your data across multiple Azure SQL databases. The discussion around sharding your data can get quite complicated depending... but Azure SQL's Elastic Scale may make the process of sharding easier: http://azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-scale-introduction/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM