9.5. Controlling How Memory is Allocated

Documentation

VoltDB Home » Documentation » Guide to Performance and Customization

9.5. Controlling How Memory is Allocated

Despite the fact that you as a developer or database administrator cannot control when temporary storage is allocated and freed, you can control how much memory is used. Java provides a way to specify the size of the heap, the portion of memory the JVM uses to store runtime data such as class instances, arrays, etc. The -Xms and -Xmx arguments to the java command specify the initial and maximum heap size, respectively.

By setting both the -Xmx and -Xms arguments, you can control not only the maximum amount of memory used, but also the amount of fluctuation that can occur. Figure 9.3, “Controlling the Java Heap Size” illustrates how the -Xms and -Xmx arguments can be used to control the overall size of temporary storage.

Figure 9.3. Controlling the Java Heap Size

Controlling the Java Heap Size

However, you must be careful when setting the values for the Java heap size, since the JVM will not exceed the value you set as a maximum. It is possible, under some conditions, to force a Java out-of-memory error if the maximum heap size is not large enough for the temporary storage VoltDB requires. See the VoltDB Planning Guide for recommendations on calculating the appropriate heap size for your specific application.

Remember, temporary storage is used to queue the procedure requests and responses. If you are using synchronous procedures calls (and therefore little or no queuing on the server) a small heap size is acceptable. Also, if the size of the procedure invocations (in terms of the arguments passed into the procedures) and the return values are small, a lower heap size is acceptable. But if you are invoking procedures asynchronously with large argument lists or return values, be very careful when setting a low maximum heap size.