Jump to content
  • How to set the amount of memory a LiveView server may use


    Issue

    How to set the amount of memory a LiveView server may use

    Solution

    Where And How to Set the JVM Heap Size

    In general, the LiveView server gets its runtime settings for the underlying StreamBase server runtime from a StreamBase Server Configuration file.

    LiveView server has set of default and/or LiveView-specific StreamBase Server Configuration settings that are the base configuration in effect when a LiveView Server is launched.

    To make LiveView project-specific overrides or additions to the default server configuration, create a file called sbd.sbconf in the root directory of the LiveView project. The file MUST be called sbd.sbconf.

    The project's sbd.sbconf may use <sb-include> or <xi:include> elements.

    The contents of the project sbd.sbconf are merged with the default LiveView server configuration settings during the compilation of the LiveView project. Settings in the project sbd.sbconf override any existing settings for the same element/attribute in LiveView's default configuration.

    LiveView Server Heap Size Setting Example: StreamBase Server Configuration File

    <?xml version="1.0" encoding="UTF-8"?>
    <streambase-configuration xmlns:xi="http://www.w3.org/2001/XInclude"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://www.streambase.com/schemas/sbconf/">
      <java-vm>
        <param name="jvm-args" value="-Xms2g -Xmx4g"/>
      </java-vm>
    </streambase-configuration>
     

    Making the Heap Size Settings Different in Different Environments

    Since the file with the name sbd.sbconf has special meaning to both StreamBase Studio and the LiveView Server compiler/runtime, the question arises as to how run different configurations using a StreamBase Studio launch or the development workstation command line and on a deployment machine.

    Today, there are several possibilites to effect this:

    • Use environment variables to set the desired memory size

    -Xms${LV_HEAP_SIZE}

    -Xmx${LV_HEAP_SIZE}

    or  

    -Xms${LV_HEAP_SIZE:=2}g

    -Xmx${LV_HEAP_SIZE:=4}g  

    • have an environment variable that is an environment-specific sbconf file to include.

    <sb-include file="${SB_CONF_FILE}"/>

    • have different sbconf files with different names and rename them prior to the LiveView Server launch

    Environment variables may be set in Studio Launch Configurations. This can be a convenient way to keep the deployment configuration as the default but to override with development settings at Studio Launch time.


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...