1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Swap Usage

Discussion in 'Enhanced Search Support' started by MattW, May 3, 2013.

  1. MattW

    MattW Well-Known Member

    Since setting up Elastic Search, my swap usage has been increasing.

    I've had it running since March 30th, and since then, my swap has gone up to 1GB of usage.

    Using smem, it's JRE that is using most of the swap

    Code:
    # smem -t -p
      PID User    Command                        Swap      USS      PSS      RSS
    2328 dbus    dbus-daemon --system          0.01%    0.00%    0.00%    0.01%
    4661 root    /sbin/mingetty xvc0            0.00%    0.00%    0.00%    0.01%
    4662 root    /sbin/mingetty tty2            0.00%    0.00%    0.00%    0.01%
    4663 root    /sbin/mingetty tty3            0.00%    0.00%    0.00%    0.01%
    4664 root    /sbin/mingetty tty4            0.00%    0.00%    0.00%    0.01%
    4665 root    /sbin/mingetty tty5            0.00%    0.00%    0.00%    0.01%
    4666 root    /sbin/mingetty tty6            0.00%    0.00%    0.00%    0.01%
    2337 root    hald-runner                    0.01%    0.00%    0.00%    0.01%
    2336 haldaemon hald                          0.11%    0.00%    0.00%    0.02%
    1972 root    iscsid                        0.00%    0.00%    0.00%    0.01%
      707 root    /sbin/udevd -d                0.02%    0.00%    0.00%    0.01%
    4435 root    /usr/sbin/xbclient            0.01%    0.00%    0.00%    0.01%
    2313 root    klogd -x                      0.00%    0.00%    0.00%    0.01%
    4443 root    /usr/sbin/atd                  0.00%    0.00%    0.00%    0.01%
        1 root    init [3]                      0.00%    0.00%    0.00%    0.01%
    2309 root    syslogd -m 0                  0.00%    0.00%    0.00%    0.01%
    14074 root    /usr/sbin/sshd                0.02%    0.00%    0.00%    0.02%
    5449 root    /elasticsearch/bin/service/    0.02%    0.00%    0.00%    0.02%
    6503 root    /usr/sbin/dovecot              0.00%    0.01%    0.01%    0.02%
    7972 root    cpdavd - accepting connecti    0.70%    0.01%    0.01%    0.02%
    9891 root    /usr/local/cpanel/bin/split    0.00%    0.00%    0.01%    0.01%
    9892 root    /usr/local/cpanel/bin/split    0.00%    0.00%    0.01%    0.01%
    19607 z22se    imap                          0.00%    0.01%    0.01%    0.03%
    19604 z22se    imap                          0.00%    0.01%    0.01%    0.03%
    19601 z22se    imap                          0.00%    0.01%    0.01%    0.03%
    7951 root    cPhulkd - processo            0.15%    0.01%    0.01%    0.03%
    7976 root    cpanellogd - sleeping for l    0.08%    0.01%    0.01%    0.03%
    9063 root    /bin/sh /usr/bin/mysqld_saf    0.00%    0.01%    0.01%    0.03%
    4424 root    crond                          0.01%    0.01%    0.01%    0.02%
    21281 root    su -                          0.00%    0.01%    0.01%    0.03%
    6513 dovecot  pop3-login                    0.02%    0.01%    0.01%    0.04%
    6512 dovecot  pop3-login                    0.02%    0.01%    0.02%    0.04%
    6504 root    dovecot-auth                  0.00%    0.02%    0.02%    0.03%
    19596 z22se    imap                          0.00%    0.01%    0.02%    0.04%
    20849 z22se    sshd: z22se@pts/0              0.00%    0.01%    0.02%    0.04%
    6515 dovecot  imap-login                    0.02%    0.02%    0.02%    0.04%
    19595 z22se    imap                          0.00%    0.01%    0.02%    0.04%
    19518 nobody  proftpd: (accepting connect    0.05%    0.02%    0.02%    0.04%
    21284 root    -bash                          0.00%    0.02%    0.02%    0.05%
    20850 z22se    -bash                          0.00%    0.02%    0.03%    0.05%
    20844 root    sshd: z22se [priv              0.00%    0.01%    0.03%    0.08%
    19598 z22se    imap                          0.00%    0.03%    0.04%    0.07%
    6514 dovecot  imap-login                    0.03%    0.04%    0.04%    0.06%
    7916 root    queueprocd - wait to proces    0.09%    0.04%    0.04%    0.06%
    1973 root    iscsid                        0.00%    0.04%    0.04%    0.07%
    6564 mailnull /usr/sbin/exim -bd -q60m      0.00%    0.06%    0.07%    0.12%
    4608 root    cpsrvd (SSL) - waiting for    0.41%    0.09%    0.09%    0.10%
    2430 ntp      ntpd -u ntp:ntp -p /var/run    0.00%    0.08%    0.09%    0.12%
    19896 root    tailwatch                      0.09%    0.11%    0.12%    0.15%
    22026 root    python /usr/local/bin/smem    0.00%    0.12%    0.12%    0.14%
    4295 root    /usr/local/apache/bin/httpd    0.09%    0.10%    0.13%    0.32%
    6583 root    /usr/local/cpanel/3rdparty/    1.89%    0.12%    0.13%    0.17%
    9897 root    /usr/local/cpanel/3rdparty/    0.00%    0.15%    0.16%    0.20%
    21934 nobody  /usr/local/apache/bin/httpd    0.08%    0.13%    0.16%    0.40%
    21981 nobody  /usr/local/apache/bin/httpd    0.08%    0.15%    0.18%    0.46%
    21785 nobody  /usr/local/apache/bin/httpd    0.08%    0.14%    0.23%    0.79%
    21821 nobody  /usr/local/apache/bin/httpd    0.08%    0.18%    0.27%    0.84%
    2346 root    lfd - sleepin                  0.00%    0.28%    0.29%    0.32%
    21979 nobody  /usr/local/apache/bin/httpd    0.08%    0.30%    0.34%    0.71%
    21975 nobody  /usr/local/apache/bin/httpd    0.08%    0.29%    0.34%    0.80%
    21694 nobody  /usr/local/apache/bin/httpd    0.08%    0.23%    0.35%    0.94%
    21930 nobody  /usr/local/apache/bin/httpd    0.08%    0.29%    0.36%    0.80%
    21736 nobody  /usr/local/apache/bin/httpd    0.07%    0.22%    0.37%    1.01%
    21982 nobody  /usr/local/apache/bin/httpd    0.08%    0.38%    0.43%    0.90%
    21976 nobody  /usr/local/apache/bin/httpd    0.08%    0.39%    0.45%    0.91%
    1967 root    iscsiuio                      0.00%    0.50%    0.51%    0.54%
    15350 root    spamd chil                    0.32%    1.45%    1.47%    1.53%
    5451 root    /usr/java/jre1.7.0_17/bin/j  24.32%  11.77%  11.77%  11.79%
    9626 mysql    /usr/sbin/mysqld --basedir=    8.91%  51.58%  51.59%  51.62%
    -------------------------------------------------------------------------------
      69 9                                      38.28%  69.51%  70.55%  76.93% 
    I've made a change to sysctl to reduce the swappiness down to 20 (was set on the default 60) to try and stop processes using swap as aggressively, but has anyone else come across this?
     
    Slavik likes this.
  2. Slavik

    Slavik XenForo Moderator Staff Member

    Edit your config and set the memory lock to true. This way it will never write to the SWAP and will keep everything in active memory.

    However.

    If you ever run out of memory that ES needs to allocate, doing this will cause it to kill the proccess if you run out of RAM for whatever reason.
     
  3. MattW

    MattW Well-Known Member

    Excellent, thanks Slavik. I've still got 1GB of ram free on the VPS, which is why I was wondering why it's using so much swap.
     
  4. yavuz

    yavuz Well-Known Member

    Sorry to bup this up, I'm getting this too. What was it what you added where @MattW :p

    caps.png
     
  5. Mouth

    Mouth Well-Known Member

    Inside elasticsearch.yml (usually located within /etc/elasticsearch/) edit
    bootstrap.mlockall: true
     
    Moshe1010 and MattW like this.

Share This Page