将聊天对话存储在键->值(noSQL)数据库中?
我正在考虑为客户编写一个快速聊天应用程序,以帮助他们解决一些沟通需求。显然,编写一个简单的聊天内容并不费脑子,但公司有严重的扩展需求,因此从一开始就在 noSQL 存储上构建服务可能是一个好主意。
除了明显缺乏事务(这不是我们关心的问题之一)之外,使用 noSQL 存储进行聊天是个好主意吗?
I am thinking about writing a quick chat application for a client to help them solve some of their communication needs. Clearly, writing a simple chat is no brainer, but the company have serious scaling needs, so it is probably a good idea to build the service on a noSQL storage from the beginning.
Besides the obvious lack of transactions, which isn't one of our concerns, is it a good idea to use a noSQL storage for a chat?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您追求可扩展性和性能,MongoDB 应该足够好。大多数 SQL 引擎对于这些东西来说都是大材小用。我怀疑您是否需要复杂的数据聚合和其他聊天数据查询。即使如此,MongoDB 也具有 Map-Reduce 功能来帮助您。
MongoDB should be good enough if you're after scalability and performance. Most SQL engines would be overkill for this stuff. I doubt if you need complex data aggregation and other queries for chat data. Even with that, MongoDB has map-reduce capability to help you along.
如果您没有固定的数据模型,则使用NoSQL,这适用于面向文档的应用程序,您必须存储对象和文档,其中每个对象和文档可能具有不同的结构。
我认为您的情况并非如此,因为聊天日志具有明确定义的固定数据模型,例如(用户、时间、文本)。我认为传统 SQL 数据库可能最适合您。如果仅在客户端使用,SQLite 将是最合适的,因为无需安装或配置,只需重新分发 SQLite dll 即可。而且占地面积非常小。
NoSQL ist used if you have no fixed data model, this applies to document oriented applications where you have to store objects and documents where each one may have a different structure.
I don't think this is the case in your situation, since a chat log has a well defined fixed data model for example (user, time, text). I think a traditional SQL database may be the right fit for you. If used on client side only, SQLite will be the best fit, since there is no need to install or configure, simply redistribute the SQLite dll. Also the footprint is very small.
我会说不。 SQLite 包含在 PHP 中...为什么不直接使用它呢?或者更好的是,为什么不使用现有的数百个聊天应用程序之一,并为自己节省大量的开发时间。
I would say no. SQLite is included in PHP... why not just use that? Or better still, why not use one of the hundreds of chat applications that already exist, and save yourself a whole load of development time.