Benchmark: Aerospike very slow compared to Redis and Mysql

I posted a StackOverflow post here, where I initially wanted to know why Couchbase was so slow. Then I added benchmarking for Aerospike, when I heard about this product.

However, Aerospike was on-par with Couchbase in reads, and slower in writes, meaning: its very slow compared to Redis and even MySql that is persisted on an SSD drive. The details are in the SO post, here are the results:

We are inserting 100 000 JSON “documents” into three db/stores:

  • Redis (just insert, there is nothing else)
  • Couchbase (in-memory Ephemeral buckets, JSON Index on JobId)
  • MySql (Simple table; Id (int), Data (MediumText), index on Id)
  • Aerospike (in-memory storage)

The JSON file is 67 lines, about 1800 bytes.

INSERT:

  • Couchbase: 60 seconds
  • MySql: 30 seconds
  • Redis: 8 seconds
  • Aerospike: 71 seconds

READ: We are reading 1000 times, and we do this 10 times and look at averages.

  • Couchbase: 600-700 ms for 1000 GETs (Using KeyValue operations, not Query API. Using Query API, this takes about 1500 ms)
  • MySql: 90-100 ms for 1000 GETs
  • Redis: 50-60 ms for 1000 GETs
  • Aerospike: 750 ms for 1000 GETs

Conclusion: Aerospike is slowest, closely followed by Couchbase. Both of these are using in-memory storage (Couchbase => Ephemeral bucket, Aerospike => storage-engine memory).

Why is Aerospike so slow, when its all in memory?

Aerospike code:

WRITES:

sw.Restart();
foreach (JObject temp in jsonObjects)
{
    aeroClient.Put(null, new Key("test", "cache", temp.GetValue("JobId").ToString()), new Bin[]
    { 
        new Bin("Id", temp.GetValue("JobId").ToString()),
        new Bin("Data", temp.ToString())
    });
}
sw.Stop();
Console.WriteLine($"Adding {nbr} to Aerospike took {sw.ElapsedMilliseconds} ms");

READS:

for (int q = 0; q < 10; q++)
{
    Stopwatch sw = Stopwatch.StartNew();
    for (int i = 0; i < nbr; i++)
    {
        Record record = aeroClient.Get(null, new Key("test", "cache", r.Next(1, 100000).ToString()), "Data");
    }
    sw.Stop();
    Console.WriteLine($"Aerospike Q: {q} \t{sw.ElapsedMilliseconds} ms");
    sw.Reset();
}

Thanks for posting this. I am not knowledgeable on how other databases handle sequential reads as such but others may have some input, let’s see. Have you tried using the async client for this test?

More importantly, my only feedback is to do some proper benchmarking across those databases to get a better real world picture (have a real network between client and database and have more than 1 node if the eventual code will be running against a multi node cluster.

© 2021 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.