Java Client: client machine cpu usage shot up to 90% while reading aerospike servers


#1

We’ve an application which handles billion of requests/day. We have started using persistent aerospike to store user profiles.

What we’ve observed, after deployment of aerospike read in my application, machine cpu shot up to 90%. I believe, we are doing something wrong when we are establishing connection with aerospike cluster.

We are using AsyncClient & persistent connection with aerospike cluster on netty server, so that we could use the same connection for frequent read calls.

Is anyone here, who can help me out. My end goal is to minimize CPU usage.

Regards,


#2

One possible reason for high cpu usage is Java serialization. It’s important to serialize data to byte[] using a more efficient serializer instead of using the following constructor:

	/**
	 * Constructor, specifying bin name and object value.
	 * This is the slowest of the Bin constructors because the type
	 * must be determined using multiple "instanceof" checks.
	 * <p>
	 * For servers configured as "single-bin", enter a null or empty name.
	 *
	 * @param name		bin name, current limit is 14 characters
	 * @param value		bin value
	 */
	public Bin(String name, Object value) {
		this.name = name;
		this.value = Value.get(value);
	}