0

BatchInserterを使用して、neo4j データベースから特定のプロパティと関係を取得し、 BatchInserterIndex を使用して新しいインデックス (数値インデックスを使用) を書き込みます

約 10 分後、インデックス フォルダーのサイズは 4.7G になり、メモリが完全に使用され、ガベージ コレクションによって処理が非常に遅くなり、しばらくすると VM がガベージ コレクター例外で終了します。

コードはおおよそ次のようになります。

    final BatchInserter bInserter = BatchInserters.inserter(this.dbStoreDir, getConfig());
    final BatchInserterIndexProvider bIndexInserterProvider = new LuceneBatchInserterIndexProvider(bInserter);
    final BatchInserterIndex bIndexInserter = bIndexInserterProvider.nodeIndex(indexName, getConfig());
    try {
        final Map<String, Object> propMap = new HashMap<>();
        for (final Long id : idSet) {
            this.filterProperties(bInserter.getNodeProperties(id), propMap);
            for (final BatchRelationship rel : bInserter.getRelationships(id)) {
                if (rel.getType().name().equals(ANYREL)) {
                    final Long subNodeId = rel.getEndNode();
                    this.filterProperties(bInserter.getNodeProperties(subNodeId).entrySet(), propMap);
                    this.filterProperties(bInserter.getRelationshipProperties(rel.getId()).entrySet(), propMap);
                }
            }
        bIndexInserter.add(id, propMap);
        propMap.clear();
        }
    } finally {
        bIndexInserter.flush();
        bInserter.shutdown();
        bIndexInserterProvider.shutdown();
    }

    public static Map<String, String> getConfig() {
        final Map<String, String> config = new HashMap<>();
        config.put("dump_configuration", "false");
        config.put("cache_type", "none");
        config.put("use_memory_mapped_buffers", "true");
        config.put("node_cache_size", "2G");
        config.put("relationship_cache_size", "800M");
        config.put("neostore.propertystore.db.index.keys.mapped_memory", "200M");
        config.put("neostore.propertystore.db.index.mapped_memory", "200M");
        config.put("neostore.nodestore.db.mapped_memory", "200M");
        config.put("neostore.relationshipstore.db.mapped_memory", "500M");
        config.put("neostore.propertystore.db.mapped_memory", "250M");
        config.put("neostore.propertystore.db.strings.mapped_memory", "250M");
        config.put("type", "exact");
        return config;
    }

次の Java VM オプションを使用します。

-D64 -Xmx13G -Xmn1G -server -XX:+UseNUMA -XX:+UseParallelGC

16GB RAM と Java 1.7_60 を搭載したマシン上

a) 私は何か間違ったことをしていますか?

b) そのすべてのメモリを使用しているのは何ですか? lucene か neo4j ですか?

c) Michael Hunger は、彼のバッチ インポーターでどのような違いを行っていますか? 私はコードを少し見ましたが、彼がどのようにそれを行っているかについては本当に手がかりがありません..

4

0 に答える 0