TokuMX支持三种压缩算法(”quicklz”, “lzma”, “zlib”)和并也可以支持不压缩(”none”),默认使用zlib压缩算法(初始版本是quicklz,后来改为zlib)。 如果觉得压缩会损失查询性能,可以尝试创建不压缩的集合: javascript toku:PRIMARY> db.runCommand({create:"t1",compression:"none"}) 插入数据 javascript toku:PRIMARY> for(var i=0;i<100000;i++) db.t1.insert({v:"aaaaaaaaa"})` 查看信息: javascript toku:PRIMARY> db.t1.stats() { "ns" : "test.t1", "count" : 100000, "nindexes" : 1, "nindexesbeingbuilt" : 1, "size" : 5200000, "storageSize" : 32768, "totalIndexSize" : 0, "totalIndexStorageSize" : 0, "indexDetails" : [ { "name" : "_id_", "count" : 100000, "size" : 5200000, "avgObjSize" : 52, "storageSize" : 32768, "pageSize" : 4194304, "readPageSize" : 65536, "fanout" : 16, "compression" : "uncompressed", "queries" : 0, "nscanned" : 0, "nscannedObjects" : 0, "inserts" : 100000, "deletes" : 0 } ], "ok" : 1 } 再看默认的情况: javascript toku:PRIMARY> for(var i=0;i<100000;i++) db.t2.insert({v:"aaaaaaaaa"}) toku:PRIMARY> db.t2.stats() { "ns" : "test.t2", "count" : 100000, "nindexes" : 1, "nindexesbeingbuilt" : 1, "size" : 5200000, "storageSize" : 16384, "totalIndexSize" : 0, "totalIndexStorageSize" : 0, "indexDetails" : [ { "name" : "_id_", "count" : 100000, "size" : 5200000, "avgObjSize" : 52, "storageSize" : 16384, "pageSize" : 4194304, "readPageSize" : 65536, "fanout" : 16, "compression" : "zlib", "queries" : 0, "nscanned" : 0, "nscannedObjects" : 0, "inserts" : 100000, "deletes" : 0 } ], "ok" : 1 } 可以看到默认大小使用zlib压缩算法。

改变压缩算法为lzma: javascript toku:PRIMARY> db.t2.reIndex('*', {compression: 'lzma'}) { "was" : [ { "name" : "_id_", "compression" : "zlib" } ], "nIndexes" : 1, "nIndexesWas" : 1, "indexes" : [ { "key" : { "_id" : 1 }, "unique" : true, "ns" : "test.t2", "name" : "_id_", "clustering" : true, "compression" : "lzma" } ], "ok" : 1 }

4 回复
leafonsword
#1 leafonsword • 2014-03-06 12:09

总感觉TokuMX这种第三方插件不靠谱…….

ccj
#2 ccj • 2014-03-06 14:40

你的理解太片面了。

Hisoka-J
#3 Hisoka-J • 2014-03-26 18:53

@ccj

我想了解一下这三种算法的优缺点

leafonsword
#4 leafonsword • 2014-03-26 20:05

@Hisoka-J quicklz、zlib、lzma网上搜搜不就有吗?

需要 登录 后方可回复, 如果你还没有账号你可以 注册 一个帐号。