为什么不像memcached那样使用MySQL呢?
出于同样的原因,在一个应用程序中同时使用 NoSQL 和 RDBMS 是有意义的,对我来说,除了 NoSQL 缓存之外还有 RDBMS 缓存也很有意义。
我正在考虑使用 MySQL 服务器,所有表都使用内存引擎。
这种方法有什么警告吗?
澄清一下,我建议仅将 MySQL 服务器用于缓存目的,而不是用于应用程序的实际数据存储。
For the same reason it makes sense to use both NoSQL and RDBMSs in one application, It makes sense to me to have an RDBMS cache besides NoSQL cache.
I was thinking about using a MySQL server with all tables using the memory engine.
Is there any caveat to this approach?
Just to clarify, I am suggesting here to use a MySQL server for caching purposes only, not for the actual data storage of my application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
内存表完全存储在内存中,因此速度非常快。
它使用哈希索引,速度也非常快,非常适合临时表目的和查找。
内存表有表级锁,所以如果需要并发,这是一个问题。
没有事务
当服务器关闭或崩溃时,所有行都丢失
,尽管表定义保持不变,但数据将全部消失。
您可能需要查看有关内存引擎的官方文档
编辑:
内存存储引擎是缓存目的的良好候选者。
以下是内存引擎的一些优点:
CREATE TEMPORARY TABLE
内存表仍然存在(如果这是您需要的)有一些缺点:
总而言之,如果您需要缓存,内存引擎应该是您的最佳选择。
Memory tables are stored entirely in memory, so it is very fast.
It uses hash indexes which are also very fast, great for temp table purposes and lookups.
Memory tables have table level locks, so if concurrency is required, this is a problem
No transactions
When server shuts down or crashes ALL ROWS ARE LOST
though table definition stays the same, the data would be all gone.
You may want to check out the official documents on the Memory Engine
EDIT:
The Memory Storage Engine is a good candidate for caching purposes.
The following are a few things that the Memory Engine is good for:
CREATE TEMPORARY TABLE
as the Memory table persists (if that is what you need)There are a few negatives:
All in all the memory engine should be the best choice for you if you need caching.
另一个原因,
与磁盘空间相比,RAM 非常有限,
您可以拥有高达 TB 的磁盘驱动器,
但很难让内存达到TB级
another reason,
RAM is much limited compared to disk space,
you can have disk drive up to terabytes,
but hardly can let memory goes up-to terabytes
如果您获得了$$,以下文章< /a> 关于 MySQL 和 InnoDB 的功能将会引起人们的高度兴趣。
它的性能优于任何类型的缓存、内存引擎或内存缓存。缺点是 - 它需要大量的内存。
If you got the $$, the following article about MySQL and InnoDB's capabilities will be of high interest.
It outperforms any sort of cache, memory engine or memcached. Drawback is - it requires ram, lots of it.