Skip to content

[question] insert seems not fast enough #2018

@weickdev

Description

@weickdev

I want to insert Person vertex like

person{
_key: xxxx,
age: xxxx
ctime: xxxxx
sequence: xxxxx
}

Below is my java code:

private void saveVertices(List<Map<String, Object>> itemList) {
        long startTime = System.currentTimeMillis();
        DgraphClient.Transaction transaction = dgraphClient.newTransaction();
        try {
            try {
                String json = JSON.toJSONString(itemList);
                DgraphProto.Mutation mutation = DgraphProto.Mutation.newBuilder().setSetJson(ByteString.copyFromUtf8(json)).build();
                transaction.mutate(mutation);
            } catch (Exception e) {
                logger.error("Node create error: ", e);
            }
            transaction.commit();
        } finally {
            transaction.discard();
        }
        logger.info("save {} items costs {}ms", itemList.size(), System.currentTimeMillis() - startTime);
    }

I can only insert 2000 person per second. It seems too slow, how I can insert them more fast I java clinet(not Live Loader nor Bulk Loader)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions