0

when i trying to load amount of data from MySQL, I commit every record to the JanusGraph with cassandra backend and elasticsearch for building index, using 8 thread;

At the beginning, the program would load at 280 records / second;
But when it process seconds it down to 1 ~ 10 records / second;

I try to modified buffer-sizepage-sizeblock-sizerenew-percentage such configures, but it doesn't improved obviously;

I just wander whether i miss something, and what contribute this situation ...

The code followed is My commit process, the dataMap is a fastJson Object, and g is a janusgraph traversal source;

    Long countryId = dataMap.getLong("countryId");

    Long uid = dataMap.getLong("uid");
    String phoneNum = dataMap.getString("phoneNumber");
    String fbId = dataMap.getString("fbId");
    Long createTime = dataMap.getLong("createTime");

    if (uid == null) {
        return;
    }
    Vertex uidVertex = g.addV("uid").next();
    uidVertex.property("uid_code", uid);

    if (createTime != null)
        uidVertex.property("create_time", createTime);
    if (status != null)
        uidVertex.property("status", status);

    g.tx().commit();

    if (phoneNum != null) {
         Vertex phoneVertex = KfkMsgParser.createMerge(g, "phone", "phone_num", phoneNum);

        Edge selfPhone = uidVertex.addEdge("user_phone", phoneVertex);
        selfPhone.property("create_time", bind.of("create_time", dataMap.getLong("createTime")));
        selfPhone.property("uid_code", bind.of("uid_code", uid));
        selfPhone.property("phone_num", bind.of("phone_num", phoneNum));
        g.tx().commit();
    }

    if(fbId != null){
        long endTamp2 = System.currentTimeMillis();
        Vertex fbVertext = KfkMsgParser.createMerge(g, "fb_id", "fb_account",fbId);

        Edge selfFb = uidVertex.addEdge("user_fb",fbVertext);
        if (createTime != null)
            selfFb.property("create_time",bind.of("create_time",createTime));
        g.tx().commit();
    }

Here is the createMerge funtion :

private static Vertex createMerge(GraphTraversalSource g, String label, String propertyKey, Object propertyValue) {
    Optional<Vertex> vertexOptional = g.V().hasLabel(label).has(propertyKey, propertyValue).tryNext();
    if (vertexOptional.isPresent()) {
        return vertexOptional.get();
    }
    Vertex vertex = g.addV(label).next();
    vertex.property(propertyKey, propertyValue);
    return vertex;
}

1 Answers1

1

It's going wrong when i building index.
I find such a topic in google group : https://groups.google.com/forum/#!msg/janusgraph-users/VPIUdlC4wNo/KiHM-s2aAwAJ
And know get 2000~3000 records/sec .