1

Topic: memory high usage

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version: ubuntu 16
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx):apache
- Manage mail accounts with iRedAdmin-Pro?no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hello,
i have iredmail server in ec2 amazon
1 cpu and 2 gig memory machine.
my trouble is, one's in a week amavis service gets stuck and the error in mail.log is
run_command: can't fork: Cannot allocate memory at /usr/sbin/amavisd-new

i saw couple of topics that saying to reduce this parameter in amavis config file:

$max_servers = 2;

i have changed it to 1.
it didnt help.

is there something else i can do to make this server use less memory?

thank you

raz

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: memory high usage

raz wrote:

$max_servers = 2;
i have changed it to 1.

Also need to change Postfix config file. Check our tutorial:
https://docs.iredmail.org/concurrent.processing.html

3

Re: memory high usage

Thank you for answering zhang
I did it already.
seems like mysql is using lots of memory
is there a way to reduce his memory usage too?

Thank you
raz

4

Re: memory high usage

You could turn off the virus scanning, if you can't allocate more memory to your server. You can also tune MySQL/MariaDB with my.cnf file, location of the file depends on distro.

5

Re: memory high usage

raz wrote:

seems like mysql is using lots of memory
is there a way to reduce his memory usage too?

Did you see MySQL eating a lot CPU/Memory with "top" command? MySQL should be fine, is your server very busy?

6 (edited by RikuS 2017-12-14 23:50:27)

Re: memory high usage

The default value for innodb_buffer_pool_size is 134217728 (128MB), so MySQL shouldn't be an issue, unless you have changed this to something higher.

7

Re: memory high usage

Hey guys
thank you for your help

i add a photo of htop of my server
please tell me what do you think

Thank
Raz

Post's attachments

Capture.PNG 160.56 kb, 1 downloads since 2017-12-16 

You don't have the permssions to download the attachments of this post.

8

Re: memory high usage

Why do you have so many mysqld processes?

9

Re: memory high usage

i dont know
i didnt change any of the config files.

mysqld.conf file:

[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
innodb_file_per_table
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 0.0.0.0
#
# * Fine Tuning
#
key_buffer_size         = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options  = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries       = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size   = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

Thank you zhang.
Raz

10

Re: memory high usage

Please Help..

11

Re: memory high usage

How busy your server is?

Even though I'm not an MySQL expert in any way, those "processes" are actually threads of a single process, and setting thread_cache_size sets the amount of extra threads the server should have all the time ready for future connections. The current amount 8 should be fine, that just means that you will have 8 threads on idle ready for new connections. Starting new threads uses processor power so it's good to have some on idle all the time. On a busy server you actually might want to set it higher.

I dont't see any issues here. If you're running out of memory, you should get more, or disable some services.