I am experiencing very different times in writing data into a set (with a secondary index already defined) and the time it takes to build it after a cold restart. I am running aerospike on on a single M3xlarge EC2 instance, SSD storage with 2000 provisioned iops. Aerospike version is Community Edition 3.9.1.1.
Inserting 35 million records and indexing on a String bin which exists in all of the records takes about 45 minutes (this could maybe be improved, but not the focus of my question), all together 32GB of data. Right after that I perform a cold restart of the server. The primary index takes about 10 minutes to build, and the secondary index takes 5 hours. iowait is around 80 at that stage. Doubling the amount of provisioned iops has a drastic improvement on the the secondary index building (but not on the primary index building time).
My question is - why are the great differences between writing performance and secondary index build time upon restart, for same size of data?
my config:
# Aerospike database configuration file.
service {
user root
group root
paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
pidfile /var/run/aerospike/asd.pid
service-threads 4
transaction-queues 4
transaction-threads-per-queue 4
proto-fd-max 15000
}
logging {
# Log file must be an absolute path.
file /var/log/aerospike/aerospike.log {
context any info
}
}
network {
service {
address any
port 3000
}
heartbeat {
mode multicast
address 239.1.99.222
port 9918
# To use unicast-mesh heartbeats, remove the 3 lines above, and see
# aerospike_mesh.conf for alternative.
interval 150
timeout 10
}
fabric {
port 3001
}
info {
port 3003
}
}
namespace prod {
replication-factor 2
memory-size 8G
default-ttl 0d # 30 days, use 0 to never expire/evict.
storage-engine device { # Configure the storage-engine to use persistence
device /dev/xvda2 # raw device. Maximum size is 2 TiB
# device /dev/<device> # (optional) another raw device.
write-block-size 128K # adjust block size to make it efficient for SSDs.
}
}