Hello,
I wrote a small Go program that creates, in an empty database, about 200 nodes and 200 edges using the Go client and dGraph nightly builds.
I takes about 17 seconds!! on my Intel® Core™ i5-3470 CPU @ 3.20GHz.
I ran profiling tests and CPU is barely used:
Type: cpu
Duration: 17.21s, Total samples = 150ms ( 0.87%)
But routine profiling shows that time is spent by gRPC calls:
Showing nodes accounting for 35.49s, 100% of 35.49s total
Dropped 43 nodes (cum <= 0.18s)
Showing top 20 nodes out of 24
flat flat% sum% cum cum%
35.49s 100% 100% 35.49s 100% runtime.selectgo
0 0% 100% 3.14s 8.84% github.com/dgraph-io/dgo.(*Dgraph).Alter
0 0% 100% 4.08s 11.49% github.com/dgraph-io/dgo.(*Txn).Commit
0 0% 100% 10.40s 29.31% github.com/dgraph-io/dgo.(*Txn).Mutate
0 0% 100% 3.14s 8.84% github.com/dgraph-io/dgo/protos/api.(*dgraphClient).Alter
0 0% 100% 4.08s 11.49% github.com/dgraph-io/dgo/protos/api.(*dgraphClient).CommitOrAbort
0 0% 100% 10.40s 29.31% github.com/dgraph-io/dgo/protos/api.(*dgraphClient).Mutate
0 0% 100% 17.75s 50.01% google.golang.org/grpc.(*ClientConn).Invoke
0 0% 100% 17.75s 50.01% google.golang.org/grpc.(*clientStream).RecvMsg
0 0% 100% 17.75s 50.01% google.golang.org/grpc.(*csAttempt).recvMsg
0 0% 100% 17.75s 50.01% google.golang.org/grpc.Invoke
0 0% 100% 17.75s 50.01% google.golang.org/grpc.invoke
0 0% 100% 17.75s 50.01% google.golang.org/grpc/transport.(*Stream).RecvCompress
0 0% 100% 17.75s 50.01% google.golang.org/grpc/transport.(*Stream).waitOnHeader
0 0% 100% 17.74s 49.99% google.golang.org/grpc/transport.(*controlBuffer).get
0 0% 100% 17.74s 49.99% google.golang.org/grpc/transport.(*loopyWriter).run
0 0% 100% 17.74s 49.99% google.golang.org/grpc/transport.newHTTP2Client.func3
I do not insert data through multi-threading yet, but I strongly feel times should be greatly shorter.
Indexes involved in my schema are:
label: string @index(term) @upsert .
source: uid @reverse @count .
target: uid @reverse @count .
If I check CPU profile on dGraph exposed endpoint during insertions, CPU is lightly used:
Duration: 30s, Total samples = 730ms ( 2.43%)
I’m quite new to Go, dGraph and Go profiling, so maybe I missed something?
Thank you