English 中文(简体)
Java disc-based HashMap
原标题:Java disc-based HashMap
  • 时间:2010-07-23 08:45:04
  •  标签:
  • java
  • hashmap

I m working on a web crawler (please don t suggest an existing one, it s not an option). I have it working the way it is expected to. My only issue is that currently I m using a sort of server/client model, where by the server does the crawling and processes the data, it then puts it in a central location.

这个地点是一等书写的物体。 在内部,该班级维持一个称为<代码>的哈希姆博。 HashMap<String, HashMap<String, String>>

我将URL作为钥匙储存在地图上的数据(我保持这些独特性),哈希姆普价值储存了该卢拉的相应数据领域,例如所有权或价值。

我偶尔会把所使用的内部物体连成一栏,但间谍是多面的,一旦我说有5条read形,记忆要求就急剧上升。

迄今为止,在哈希姆普邦,15K URLs在2.r分钟以大约30秒为时30秒时被拖网,因此,我确实没有必要在像大多数论坛用户所建议的那样,向现有的间谍指出。

谁能提出一种快速的偏好的解决办法,可能支持同时阅读和读写? 数据结构必须相同,仅需要能够将相关元值合并起来。

最佳回答

我建议为此使用EhCache,尽管你重建的楼面确实是一个藏匿点。 EhCache允许你没收海滩,以便它能够过度储存,同时保存最新的物品。 也可以将其配置成不适当的结构,即数据流散,以分解,并在启动时重新注入记忆。 其中最重要的是,它具有关键价值,因此它已经符合你的模式。 它支持同时存取,而且由于磁盘储存是作为一个单独的透镜来管理的,你就不必担心磁盘进入会合。

或者,你可以考虑一个适当的嵌入式数据库,例如Hypersonic (或许多类似风格的其他人),但这可能是更多的工作。

问题回答

JDBM2 图书馆为 Java提供持续地图。 其快乐。

UPDATE: Evolved into MapDB project

rel=“nofollow noreferer”>Tokyo Cabinet,这是快速执行磁盘背面表。

在你的情况下,我认为在这种设置中储存价值的最佳方式是预先确定元数据的关键。

[url]_[name] => [value]
[url]_[name2] => [value2]

不幸的是,我不相信你能够利用这一解决办法,为某一特定的URL收集元数据。

如果你想要使用结构更完善的数据储存,我也建议使用MongoDB和QQite。

what about using JPA in your class, and persist data in a database (that can be text based like sqlite) http://en.wikipedia.org/wiki/Java_Persistence_API

Chronicle Map是可移植的,基于h的 Java数据储存,将数据保存到磁盘上(单单文档),其目标为下级更换。 相联的HashMap(提供相同的<代码>Con CurrentMap 接口)。 《纪事》地图是: ,其特征是读/write的优异性,几乎直线上调机中现有核心数。

申斥: 我是《纪事地图》的制定者。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签