1 Minimal Requirements
The system should provide at least 4GB of memory and it is mandatory to use a 64Bit Kernel/System.
Overview over memory distribution for the basic Gentics Content.Node package.
Programm | Memory Usage |
---|---|
MySQL | 500 MB |
Apache + APC | 600 MB |
JVM + JCS-Cache | 1024 MB |
Total | 2124 MB |
2 CMS Tomcat Memory
Additionally the JVM memory settings can be set in the /Node/etc/env.sh file. The -Xmx and -Xms values need to be changed.
export JAVA_OPTS="-Dcom.gentics.contentnode.config.url=http://localhost/.Node/?do=24 -Xmx2560m -Xms2560m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true"
Additional configuration files for the tomcat can be found at the following locations:
- /Node/etc/tomcat/*.xml
- /Node/etc/tomcat/*.properties
Please note that 32-bit systems cannot allocate more than 1500MB. On 64-bit systems this limit does not apply.
2.1 Native File Utils
By default the Gentics Content.Node NativeFileUtils are enabled. Those utils do support symlinks but require more memory than the JavaFileUtils. Using the NativeFileUtils can also enhance the publish performance because writing files in the filesystem can be achived by creating symlinks or hardlinks.
The fileutils can be set using the fileutils.class setting in the node conf:
// @FEATURE hardlink_files: Write files during publishing as hard links instead // of copying the dbfiles. (This has the same characteristics of copying // files, but with the performance benefit of symlink_files.) $FEATURE["hardlink_files"] = true; $JCONFIG['fileutils.class'] = 'com.gentics.contentnode.publish.NativeFileUtils'; // or $JCONFIG['fileutils.class'] = 'com.gentics.contentnode.publish.JavaFileUtils';
If you have a 64 bit system, you should also use the 64 bit fileutils:
# Create a new symlink for libgtx_fileutils_64.so.1.0 cd /Node/lib unlink libgtx_fileutils.so.1.0 ln -s /Node/.node/modules/content/files/libgtx_fileutils_64.so.1.0 libgtx_fileutils.so.1.0
Possible error messages that are caused by insufficient memory are:
finalizing filewrite: could not delete pub_old! Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory
2.2 JCS Cache Size
The node object cache is a Java cache inside of the CMS Tomcat. This cache is used to cache node objects like pages, templates and files. Increasing this memory can help speed up the loading times of pages in preview mode and the publishing process.
jcs.region.gentics-nodeobjects.cacheattributes.MaxObjects=100000
By default the largest cache region is configured to hold 100k objects. An object size of 1kB is assumed for this cache setting. The memory requirements depend upon the existing content. The profiler webapp can be used to create a differential measurement (Full GC, Check Used Memory, Cache Clear). An OutOfMemoryException or stalling garbage collection can occur when the cache region is too large for the heap memory.
2.2.1 Rule of thumb
Assume 50 kB to 300 kB per object and apply the following formula:
Cache memory usage = 50 kB * object count (Page, Folder, Image, File…) to 300 kB * object count (Page, Folder, Image, File…).
2.3 Import Export
The memory usage for the Import/Export feature during transports involving large amounts of data can vary greatly and depends upon the complexity of the implementation of the existing content.
3 MySQL Memory
The main MySQL settings are innodb_buffer_pool_size and innodb_log_file_size.
// This option will change the way the mysql synchonizes the written data // with the disk. Value 2 means that the sync action for the mysql data // logfile is invoked once per second. innodb_flush_log_at_trx_commit=2 // Should be 50-80% of main mysql memory innodb_buffer_pool_size=2048M // Should be 25% of innodb_buffer_pool_size innodb_log_file_size=512M // Be careful not to set the size of the cache too large. Due to the need // for threads to lock the cache during updates, you may see lock contention // issues with a very large cache. query_cache_size=64M
Please note that changes to innodb_log_file_size require the deletion of the MySQL logfile and a restart of the MySQL server.
cd /Node/var/mysql rm ib_logfile* /Node/bin/nodectl restart mysql
Currently the only a 32bit version of the MySQL server is provided in the Gentics Content.Node package. This version only allows up to 3GB of MySQL memory usage. It is highly encouraged to install a compatible 64bit MySQL server version. Please refer to your linux distribution on how to obtain the MySQL server installation.
4 Apache
The memory usage is defined by the amount of started child processes. On average a child process uses about 5MB of memory.
The settings used are MinSpareServers and MaxClients.
The Apache configuration settins are located in /Node/etc/httpd.custom.conf
- /Node/apache/conf/httpd.common.conf
The common configuration file for the Apache server.
- /Node/apache/conf/httpd.conf
This file contains the main configration for the Apache server.
- /Node/apache/conf/httpd.custom.conf
This file should be used to store local user defined settings. This file will not be changed during the update process.
4.1 APC PHP Cache
You can also tune the APC PHP Cache settings. Normally these settings can be left unchanged.
[APC] extension=apc.so apc.enabled=1 apc.shm_size=128M apc.ttl=7200 apc.user_ttl=7200 apc.max_file_size=16M
5 Example Configuration
Note: Please note that the following values should only be considered as a guideline for planned memory setups.
5.1 8 GB
# /Node/etc/tomcat/gentics/cache.ccf - 380k (10k per object) jcs.region.gentics-nodeobjects.cacheattributes.MaxObjects=380000 # /Node/etc/env.sh export JAVA_OPTS="-Dcom.gentics.contentnode.config.url=http://localhost/.Node/?do=24 -Xmx3686m -Xms3686m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true" # /Node/etc/my.cnf innodb_flush_log_at_trx_commit=2 innodb_buffer_pool_size=3276M innodb_log_file_size=819M query_cache_size=64M # /Node/etc/php/php.ini apc.shm_size=128M
5.2 16 GB
# /Node/etc/tomcat/gentics/cache.ccf - 780k (10kb per object) jcs.region.gentics-nodeobjects.cacheattributes.MaxObjects=780000 # /Node/etc/env.sh export JAVA_OPTS="-Dcom.gentics.contentnode.config.url=http://localhost/.Node/?do=24 -Xmx7680m -Xms7680m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true" # /Node/etc/my.cnf innodb_flush_log_at_trx_commit=2 innodb_buffer_pool_size=6656M innodb_log_file_size=1664M query_cache_size=128M # /Node/etc/php/php.ini apc.shm_size=256M
5.3 32 GB
# /Node/etc/tomcat/gentics/cache.ccf - 1.5 million (10kb per object) jcs.region.gentics-nodeobjects.cacheattributes.MaxObjects=1500000 # /Node/etc/env.sh export JAVA_OPTS="-Dcom.gentics.contentnode.config.url=http://localhost/.Node/?do=24 -Xmx14336m -Xms14336m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true" # /Node/etc/my.cnf innodb_flush_log_at_trx_commit=2 innodb_buffer_pool_size=13312M innodb_log_file_size=3328M query_cache_size=128M # /Node/etc/php/php.ini apc.shm_size=512M
6 Memory Formula
Memory Value | Formula/Value |
---|---|
Avarage Object Size (Pages, Files, Folders, Images..) | 10 kB |
MySQL Memory | Total Memory * 0.4 |
Java Heap Memory | Total Memory * 0.45 |
JCS Node Object Cache Count | (JavaMemory * 0.75) / Avarage Object Size |
Apache + APC Memory | 0.5 GB |
System Memory | 0.5 GB |