1. <i id='i8OEZ'><tr id='i8OEZ'><dt id='i8OEZ'><q id='i8OEZ'><span id='i8OEZ'><b id='i8OEZ'><form id='i8OEZ'><ins id='i8OEZ'></ins><ul id='i8OEZ'></ul><sub id='i8OEZ'></sub></form><legend id='i8OEZ'></legend><bdo id='i8OEZ'><pre id='i8OEZ'><center id='i8OEZ'></center></pre></bdo></b><th id='i8OEZ'></th></span></q></dt></tr></i><div id='i8OEZ'><tfoot id='i8OEZ'></tfoot><dl id='i8OEZ'><fieldset id='i8OEZ'></fieldset></dl></div>
        <tfoot id='i8OEZ'></tfoot>

        <legend id='i8OEZ'><style id='i8OEZ'><dir id='i8OEZ'><q id='i8OEZ'></q></dir></style></legend>

        <small id='i8OEZ'></small><noframes id='i8OEZ'>

          <bdo id='i8OEZ'></bdo><ul id='i8OEZ'></ul>
      2. 键值存储建议

        时间:2023-09-28
          <tbody id='YNRRB'></tbody>

        1. <legend id='YNRRB'><style id='YNRRB'><dir id='YNRRB'><q id='YNRRB'></q></dir></style></legend>

            1. <small id='YNRRB'></small><noframes id='YNRRB'>

                <bdo id='YNRRB'></bdo><ul id='YNRRB'></ul>

                <tfoot id='YNRRB'></tfoot>
                  <i id='YNRRB'><tr id='YNRRB'><dt id='YNRRB'><q id='YNRRB'><span id='YNRRB'><b id='YNRRB'><form id='YNRRB'><ins id='YNRRB'></ins><ul id='YNRRB'></ul><sub id='YNRRB'></sub></form><legend id='YNRRB'></legend><bdo id='YNRRB'><pre id='YNRRB'><center id='YNRRB'></center></pre></bdo></b><th id='YNRRB'></th></span></q></dt></tr></i><div id='YNRRB'><tfoot id='YNRRB'></tfoot><dl id='YNRRB'><fieldset id='YNRRB'></fieldset></dl></div>
                  本文介绍了键值存储建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要一个非常基本的 Java 键值对存储.我从 HashMap 开始,但似乎 HashMap 有点空间效率低下(我存储了大约 2000 万条记录,并且似乎需要大约 6GB RAM).

                  I need a very basic key-value store for java. I started with a HashMap but it seems that HashMap is somewhat space inefficient (I'm storing ~20 million records, and seems to require ~6GB RAM).

                  地图是 Map,所以我正在考虑使用 GNU Trove TIntObjectHashMap,并将地图值存储为一个 ascii 字节数组而不是字符串.

                  The map is Map<Integer,String>, and so I'm considering using GNU Trove TIntObjectHashMap<byte[]>, and storing the map value as an ascii byte array rather than String.

                  作为替代方案,是否有一个键值存储只需要添加 jar 文件,不会一次将整个映射保存在 RAM 中,并且仍然相当快?

                  As an alternative to that, is there a key-value store that only requires adding jar files, does not hold the entire map in RAM at once, and is still reasonably fast?

                  推荐答案

                  使用伯克利数据库.

                  Berkeley DB 将对象图、集合中的对象或简单的二进制键/值数据直接存储在磁盘上的 btree 中.这种简单、高效的方法消除了 ORM 解决方案中所有不必要的开销.使用直接持久层 (DPL) Java 开发人员使用存储信息对类进行注释,这与 JPA 非常相似.这种方法熟悉、高效且快速.DPL 在不牺牲速度的情况下降低了数据存储的复杂性.

                  Berkeley DB stores object graphs, objects in collections, or simple binary key/value data directly in an a btree on disk. This simple, highly efficient approach removes all the unnecessary overhead in ORM solutions. Using the Direct Persistence Layer (DPL) Java developers annotate classes with storage information, much like JPA. This approach is familiar, efficient, and fast. The DPL reduces the complexity of data storage while not sacrificing speed.

                  这肯定会给您带来内存和速度方面的巨大收益,同时不会增加应用程序的复杂性.享受吧!

                  This should definitely give you huge gains in memory and speed, while not increasing the complexity of your application. Enjoy!

                  这篇关于键值存储建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                • <small id='4MGI9'></small><noframes id='4MGI9'>

                  • <legend id='4MGI9'><style id='4MGI9'><dir id='4MGI9'><q id='4MGI9'></q></dir></style></legend>

                      <bdo id='4MGI9'></bdo><ul id='4MGI9'></ul>
                          <tbody id='4MGI9'></tbody>

                        1. <i id='4MGI9'><tr id='4MGI9'><dt id='4MGI9'><q id='4MGI9'><span id='4MGI9'><b id='4MGI9'><form id='4MGI9'><ins id='4MGI9'></ins><ul id='4MGI9'></ul><sub id='4MGI9'></sub></form><legend id='4MGI9'></legend><bdo id='4MGI9'><pre id='4MGI9'><center id='4MGI9'></center></pre></bdo></b><th id='4MGI9'></th></span></q></dt></tr></i><div id='4MGI9'><tfoot id='4MGI9'></tfoot><dl id='4MGI9'><fieldset id='4MGI9'></fieldset></dl></div>
                          <tfoot id='4MGI9'></tfoot>