MySQL跟踪系统 [英] MySQL tracking system

查看:66
本文介绍了MySQL跟踪系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须实现一个由MySQL数据库备份的跟踪系统.系统将跟踪许多应用程序,并为每个应用程序至少跟踪5个事件(例如,有多少用户点击了链接x,有多少用户访问了页面y).某些应用程序将拥有数百万的用户,因此每秒进行数千次更新并不是一个难以理解的假设. 系统的另一个组件将必须计算一些统计信息,该信息应每分钟更新一次.系统还应记录这些统计值的过去值.

I have to implement a tracking system backed up by a MySQL database. The system will track many apps with at least 5 events tracked for each app (e.g. how many users clicked on link x, how many users visited page y). Some apps will have millions of users so a few thousand updates/second is not a far fetched assumption. Another component of the system will have to compute some statistical info that should be update every minute. The system should also record past values of those statistical values.

我的一个朋友建议的方法是将每个事件记录在一个日志表中,并执行一项cron作业,该作业每分钟运行一次,并计算所需的信息并更新统计信息表.

The approach a friend of mine suggested was to log every event in a log table and have a cron job that runs every minute and computes the desired info and updates a stats table.

这对我来说听起来很合理.有更好的选择吗?

This sounds reasonable to me. Are there better alternatives?

谢谢.

推荐答案

如果命中率太高,甚至无法将已插入myisam表中的插入内容进行处理,则您可能希望将最近的命中保留在内存中(内存缓存可以派上用场,或您可以编写的自定义守护程序),并定期将内存中的匹配数据处理到数据库统计信息表中(汇总).

if your hits rate it too high for even insert delated into myisam table to handle, you may want to keep recent hits in memory (memcache can come in handy, or a custom daemon you can write) and process the hits from memory periodically into the database stats table (aggregated).

这篇关于MySQL跟踪系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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