I have to believe I MUST be doing something wrong. I am a database expert by the way, having worked in engineering and consulting at database companies for 24 years, and I'm a language expert in over 13 languages. So I know what I am doing.
But when I run a simple benchmark for simple inserts into an ODBMS or RDBMS, or just about any other DBMS, records with two columns (or properties) I consistently get between 10,000 up to 30,000 tps. But with Neo4j I get an appalling 11 tps. I was getting over 10,000 TPS 23 years ago with ObjectStore, so I cannot understand why when I follow documentation I only get 11 TPS with Neo4j? Can someone point out what I am doing incorrectly?
I have to be doing something terribly wrong. This same hardware (64 GB RAM, 2 TB NVMe, 10 Gbps Eth) gets bleeding edge performance with any other database. I have assigned 16 GB to the database. And I am simply trying to insert a few dozen records, upwards of a few thousand. So this is a VERY SMALL database, no reason to be slow. And I am not setting up ANY relationships, only inserting nodes.
Can someone explain to me what I could possibly be doing wrong in the code below that would result in this sort of performance? I am literally copying the code out of the golang driver "benchmark" (for the most part).
ctx := context.Background()
// create an auth token...
neo4jAuthToken := getNeoAuthToken(neo4jUsername, neo4jPassword, neo4jRealm)
// create a driver...
driver, err := neo4j.NewDriverWithContext(neo4jUri, neo4jAuthToken)
if err != nil {
log.Fatal(err)
}
defer driver.Close(ctx)
if err := driver.VerifyConnectivity(ctx); err != nil {
log.Fatalf("failed to verify connection: %s", err)
}
// create the session configuration...
config := neo4j.SessionConfig{
AccessMode: neo4j.AccessModeWrite,
}
count := 100
start := time.Now()
for i := 0; i < count; i++ {
session := driver.NewSession(ctx, config)
defer session.Close(ctx)
name := fmt.Sprintf("jim_%d", i)
_, err = session.Run(ctx, `CREATE (n:Account {name: $name, hash: $hash}) RETURN n`,
map[string]interface{}{
"name": name,
"hash": hash(name),
})
if err != nil {
log.Fatal(err)
}
}
elapsed := time.Since(start).Milliseconds()
rate := float64(count) * 1000 / float64(elapsed)
fmt.Println("Time to load: " + strconv.Itoa(int(elapsed)))
fmt.Println("Rate in load: " + fmt.Sprintf("%f", rate))
``