跟踪用户最近活动的策略 [英] Strategy for tracking user recent activity

查看:150
本文介绍了跟踪用户最近活动的策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的客户想知道在线,目前正在使用我们为他们编写的自定义应用程序。我和他们讨论过,这不需要确切,更多的客人会工作。



所以我的想法是一个15分钟的时间间隔来确定用户活动。我这样做的一些想法如下:


  1. 在上次活动的日期和时间时间他们做一些命中数据库,或请求一个网页...这虽然可能是相当数据库密集。


  2. 发送一个谁在线请求从我们的软件,寻找响应,这可以在预定的时间间隔,然后戳记用当前日期和时间为我收到的每个响应的用户记录。


你的想法是什么?



我想要如果可能,请对Windows或Web使用相同的架构。我有一个单一的业务逻辑层,多个用户界面交互,可以是Windows或Web。



通过Windows我将意味着客户端服务器。



澄清



我使用n层体系结构,所以我的业务对象处理所有的交互表示层。该表示层可以馈送客户端 - 服务器Windows应用程序,Web应用程序,Web服务等。



它不是一个高流量应用程序,因为它是为我们的客户开发的,可能最多100个用户。

解决方案

我们的解决方案是维护一个事务表(它遵循做了什么),除了我们的会话表(跟随谁在这里)。 UPDATE,INSERT和DELETE指令都通过一个事务对象来管理,并且每当这些SQL指令在数据库上成功执行后,这些SQL指令就存储在事务表中(取决于更新的表:我们可以具体遵循一些表并忽略其他)。这个事务表具有其他字段,例如transactiontType(用于INSERT的I,用于DELETE的D,用于UPDATE的U),事务日期时间等,以及外键sessionId,最后告诉我们发送指令的谁。通过一些代码,甚至有可能识别谁做什么和什么时候(Gus在星期一创建了记录,Tim每天更改单价,Liz在星期四添加额外的折扣等)。



此解决方案的优点是:


  1. 您可以告诉什么时间和什么时间以显示给您的用户! (您需要一些代码来分析SQL语句)

  2. 如果您的数据被复制,并且复制失败,您可以通过此表重建数据库

缺点是


  1. 每月100 000次数据更新意味着Tbl_Transaction中有100 000条记录


  2. 我们的选择:所有超过90天的记录都会每天早晨自动删除


    Our customer would like to know who is online and currently using the custom application we wrote for them. I discussed it with them and this does not need to be exact, more of a guestimate will work.

    So my thought is a 15 minute time interval to determine user activity. Some ideas I have for doing this are as follows:

    1. Stamp their user record with a date and time of their last activity every time they do something that hits the database, or requests a web page ... this though could be quite database intensive.

    2. Send out a "who is online request" from our software, looking for responses, this could be done at a scheduled interval, and then stamp the user record with the current date and time for each response I received.

    What are your thoughts? And how would you handle this situation?

    Clarification

    I would like to use the same architecture for both Windows or the Web if possible. I have a single business logic layer that multiple user interfaces interact with, could be Windows or the Web.

    By Windows I would mean client-server.

    Clarification

    I am using an n-tier architecture so my business objects handle all the interaction with the presentation layer. That presentation layer could be feeding a client-server Windows application, Web application, Web Service and so on.

    It is not a high traffic application, as it was developed for a customer of ours, maybe 100 users at most.

    解决方案

    Our solution is to maintain a "Transaction" table (which follows what was done), in addition to our "Session" table (which follows who was here). UPDATE, INSERT and DELETE instructions are all managed through a "Transaction" object and each of these SQL instruction is stored in the "Transaction" table once it has been successfully executed on the database (depending on tables updated: we have the possibility to specifically follow some tables and ignore others). This "Transaction" table has other fields such as transactiontType (I for INSERT, D for DELETE, U for UPDATE), transactionDateTime, etc, and a foreign key "sessionId", telling us finally who sent the instruction. It is even possible, through some code, to identify who did what and when (Gus created the record on monday, Tim changed the Unit Price on tuesday, Liz added an extra discount on thursday, etc).

    Pros for this solution are:

    1. you're able to tell "what who and when", and to show it to your users! (you'll need some code to analyse SQL statements)
    2. if your data is replicated, and replication fails, you can rebuild your database through this table

    Cons are

    1. 100 000 data updates per month mean 100 000 records in Tbl_Transaction
    2. Finally, this table tends to be 99% of your database volume

    Our choice: all records older than 90 days are automatically deleted every morning

    这篇关于跟踪用户最近活动的策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆