1

我有大约 2900 万个单独的 unicode 元素要序列化到数据库中。我当前的解决方案使用 SQLite,并且每次发送一个长度为 100,000 的列表:

cursor.executemany("insert into array values (?)", [list of length 100,000])

我认为这会足够有效,但是在睡觉和醒来(比如 6 小时)之后,看到它还没有完成,我不这么认为。

MongoDB 或 memcached 解决方案会更有效吗?

(随意提出任何更有效的方法)

4

2 回答 2

0

如果您决定选择 memcached,请以下面提到的注意事项为例。

Memcached has a default setting of maximum data size that can be set as 1Mb. 
Any data size greater then that would require you to start the memcached explicitly stating the maximum size.

我真的很喜欢使用 redis 来存储数据结构。因为你的要求不是很清楚。我建议您使用 redis,因为您可以以多种方式存储它并有趣地使用它。

请阅读可存储在 redis 上的不同数据结构的文档。

http://redis.io/documentation

于 2012-06-11T11:42:33.070 回答
-1

尝试产生gevent线程,例如 10 并监视在给定时间内处理了多少记录,并尝试增加数量。您还应该调查multiprocessing

于 2012-06-11T06:33:25.593 回答