简体   繁体   English

有2个数据库时有什么陷阱需要注意,一个短期数据库和一个长期数据库

[英]Are there any pitfalls to watch for when having 2 databases, one for short-term and one for long-term

On our site, we record mouse movements and clicks, which with limited traffic is fine but I can imagine would slow things down when there is significantly more people browsing the website. 在我们的网站上,我们记录了鼠标的移动和点击,这在有限的访问量之内是可以的,但是我可以想象当有更多人浏览该网站时,它会使速度降低。 I figure that having a replica database for long-term storage is a good idea (to my limited knowledge, this is how computer systems handle memory anyway). 我认为拥有一个副本数据库进行长期存储是一个好主意(据我有限的知识,无论如何这是计算机系统处理内存的方式)。 This way, during the nighttime we'll clear out the short-term database and update the long-term one. 这样,在夜间,我们将清除短期数据库并更新长期数据库。

Are there any disadvantages, pitfalls, or general notes about doing this? 这样做是否有任何缺点,陷阱或一般注意事项? And in the case that this is not an efficient method, is there a better way of doing this? 如果这不是一种有效的方法,是否有更好的方法呢?

You haven't mentioned what server you use, but I would suggest using a document store, like http://www.mongodb.org/ or http://couchdb.apache.org/ , you can find a nice list here: http://nosql-database.org/ 您没有提到要使用的服务器,但是我建议使用文档存储,例如http://www.mongodb.org/http://couchdb.apache.org/ ,您可以在这里找到一个不错的列表: http://nosql-database.org/

I wouldn't think you would need to break your data into short term / long term, if you do run into performance issues, I would suggest thinking about scaling horizontally. 我认为您不需要将数据分为短期/长期数据,如果您确实遇到性能问题,我建议考虑水平扩展。

Another option would be to use a hosted service like Amazon's SimpleDb, you could have your data stored in something like mongo initially and then have a few worker processes that move your data into simpledb in the background (you wouldn't want to add the overhead of the API call to your web app). 另一种选择是使用托管服务,例如Amazon的SimpleDb,您可以将数据最初存储在mongo之类的东西中,然后有一些工作进程在后台将数据移入simpledb(您不希望增加开销) API调用您的Web应用程序)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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