Difference between revisions of "Optimizing Memory Usage"

From Zenoss Wiki
Jump to: navigation, search
(Add note about ZEN-2648.)
(MySQL/zends)
Line 14: Line 14:
  
 
<pre>
 
<pre>
 +
[mysqld]
 +
max_allowed_packet=64M
 
innodb_buffer_pool_size = 256M
 
innodb_buffer_pool_size = 256M
 
# log file size should be 25% of of buffer pool size
 
# log file size should be 25% of of buffer pool size
Line 19: Line 21:
 
innodb_additional_mem_pool_size = 16M
 
innodb_additional_mem_pool_size = 16M
 
innodb_log_buffer_size = 4M
 
innodb_log_buffer_size = 4M
 +
innodb_fast_shutdown = 1
 +
innodb_flush_log_at_trx_commit = 2
 +
 +
[mysqldump]
 +
quick
 +
max_allowed_packet = 64M
 
</pre>
 
</pre>
  

Revision as of 18:42, 21 September 2012

Zenoss 4

Zenoss 4 uses several new technologies including RabbitMQ and some Java-based applications, which can consume quite a bit of memory. The minimum recommended amount of RAM for a Zenoss 4.x install is 8GB.

This section will document some steps you can use to make Zenoss more memory-efficient for deployments with relatively low numbers of managed devices, where extreme scalability is not a concern.

MySQL/zends

Zenoss Core 4 uses MySQL.

The commercial version of Zenoss uses zends. Zends is a commercially-licensed version of MySQL that is included with Zenoss Service Dynamics. By default, it is tuned to handle up to 2000 devices. For smaller installations, the pool and cache sizes may be a bit high.

To change settings for MySQL, edit /opt/zenoss/etc/my.cnf (or /opt/zends/etc/zends.conf if you are using the commercial version.) Change innodb_buffer_pool_size to a smaller value, such as 256M. You can also lower the other sizes accordingly. Suggested minimal configuration:

[mysqld]
max_allowed_packet=64M
innodb_buffer_pool_size = 256M
# log file size should be 25% of of buffer pool size
innodb_log_file_size = 64M
innodb_additional_mem_pool_size = 16M
innodb_log_buffer_size = 4M
innodb_fast_shutdown = 1
innodb_flush_log_at_trx_commit = 2

[mysqldump]
quick
max_allowed_packet = 64M

You will need to edit this file as root. After making changes, perform the following steps:

# /etc/init.d/mysql restart

For the commercial version, you will want to use the zends initscript:

# /etc/init.d/zends stop
# rm /etc/zends/data/ib_logfile*
# /etc/init.d/zends start

zeneventserver

Zeneventserver is a new Java-based event server for Zenoss. By default, it will allow the Java heap to get quite large. This can be modified by editing the /opt/zenoss/bin/zeneventserver script and appending an -Xmx512m option to the DEFAULT_ZEP_JVM_ARGS file, as follows:

DEFAULT_ZEP_JVM_ARGS=${DEFAULT_ZEP_JVM_ARGS:-"-server -Xmx512m"}

Type zeneventserver restart as the zenoss user to apply these new settings.

Stopping Daemons

Zenoss uses ZenPacks to extend functionality of the core product, and also includes some additional daemons that you may not need. To turn extra daemons off, perform the following steps:

# touch /opt/zenoss/etc/DAEMONS_TXT_ONLY

Then create a file called /opt/zenoss/etc/daemons.txt that contains something like this:

zeneventserver
zeneventd
zenwebserver 
zenhub
zenjobs
zenping 
zensyslog
zenstatus
zenactiond 
zentrap 
zenmodeler
zenperfsnmp
zencommand
zenprocess
zenrrdcached
zenwin
zeneventlog 
#zenjmx 
zenjserver 
zenwinperf 
zenmailtx 
zenwebtx
#zenvmwareevents
#zenvmwareperf
#zenvmwaremodeler
#zenucsevents
#zenvcloud
zenimpactserver
zenimpactstate
zenimpactgraph 
zenperfetl 
zenetl 

The list above is a list of all daemons that start when you run zenoss restart as the zenoss user. I've commented out the ones I don't want by appending a #.

Now modify /opt/zenoss/bin/zenoss and change this part of the file:

if [ -f "$ZENHOME/etc/daemons.txt" ]
then
    D=`cat $ZENHOME/etc/daemons.txt`
    C="$C $D"
fi

...so that it looks like this...

if [ -f "$ZENHOME/etc/daemons.txt" ]
then
    D=`cat $ZENHOME/etc/daemons.txt | grep -v "^#"`
    C="$C $D"
fi

This will cause zenoss to skip the commented-out daemons and only start the daemons you need. You can always come back to the daemons.txt file and modify it as necessary as you utilize more Zenoss functionality in the future. In the mean-time, your memory footprint will be a bit smaller :)

An issue has been created to have comments be valid in daemons.txt without requiring the above patch. See ZEN-2648.