Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Webstacks That Run on LES servers
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Webstacks That Run on LES servers

Any webstacks that run on LES/Inception hosting servers without swapping?

Anthony does 128mb/256mb servers.

I'm running nginx, mariadb 10.1, memcached and php5.6-fpm on dacentec's 512MB ovz server and it's swapping already with only 2 active wordpress installs.

             total       used       free     shared    buffers     cached
Mem:          512M       483M        28M        71M         0B       342M
-/+ buffers/cache:       140M       371M
Swap:         256M       110M       145M

I'm not an expert by any means, so I'm only doing minimal/no tweaks on default settings. It seems mysql is eating most of my ram. I used php5fpm in static mode with 2pools with 2 children each, but now I'm putting them into on-demand instead with max 2 children only with a 10s timeout window.

Comments

  • rm_rm_ IPv6 Advocate, Veteran
    edited October 2015

    Disabling "performance schema" https://mariadb.com/blog/starting-mysql-low-memory-virtual-machines
    and disabling InnoDB if your WordPress doesn't use it http://lowendbox.com/blog/reducing-mysql-memory-usage-for-low-end-boxes/
    should free up a lot of RAM.

    For further advice you should post the output of top sorted by memory usage (shift-M)

    Thanked by 1GM2015
  • how much traffic is it?

    Thanked by 1GM2015
  • Wordpress by default uses mysql's default db storage engine, which is innodb from reading this: http://markmaunder.com/2011/06/23/wordpress-myisam-vs-innodb-mysql/.

    How bad is MyISAM's table locking?

    Anyway, here's TOP:

     6742 mysql     20   0  976628 113536   4808 S  0.0 21.7  12:23.96 mysqld       
     2425 memcache  20   0   85212  30192    868 S  0.0  5.8   0:03.64 memcached    
     3159 root      20   0   99464   4456   1568 S  0.0  0.8   0:00.07 php5-fpm     
     3123 root      20   0   11140   3496   2744 S  0.0  0.7   0:00.11 sshd         
     2789 root      20   0   11004   3116   2644 S  0.0  0.6   0:00.03 sshd         
     3200 www-data  20   0    6884   2012    932 S  0.0  0.4   0:00.11 nginx        
     3132 root      20   0    5156   1940   1520 S  0.0  0.4   0:00.01 bash         
    23373 root      20   0    5972   1900   1468 S  0.0  0.4   0:17.64 openvpn      
     2799 1002      20   0    5104   1896   1528 S  0.0  0.4   0:00.08 bash         
     2798 1002      20   0   11004   1536   1012 S  0.0  0.3   0:00.08 sshd         
     3249 root      20   0    4740   1332   1020 R  0.0  0.3   0:00.41 top          
     3197 root      20   0    6412    892    292 S  0.0  0.2   0:00.00 nginx        
    23129 root      20   0   36820    800    572 S  0.0  0.2   0:00.26 rsyslogd     
    22878 message+  20   0    4936    772    612 S  0.0  0.1   0:00.10 dbus-daemon  
        1 root      20   0    3144    568    292 S  0.0  0.1   0:01.38 init         
    22645 root      20   0    4640    532    404 S  0.0  0.1   0:00.43 cron         
    23255 root      20   0    7796    364    256 S  0.0  0.1   0:00.15 sshd   
    

    rm_ said: Disabling "performance schema" https://mariadb.com/blog/starting-mysql-low-memory-virtual-machines and disabling InnoDB if your WordPress doesn't use it http://lowendbox.com/blog/reducing-mysql-memory-usage-for-low-end-boxes/ should free up a lot of RAM.

  • GM2015GM2015 Member
    edited October 2015

    New projects, so not much in the first 2 months, then possibly daily 100-300 visitors.

    I was thinking about using some of LES servers as analytics server. Dacentec New York to digitalocean london is 90ms.

    utama said: how much traffic is it?

  • Looks like you are using the default memory hungry MariaDB configuration. You should really optimize it and do what @rm_ said. I'm using Wordpress with MyISAM and it's working pretty good under MariaDB 10.0 (stable, your 10.1 is dev).

    Thanked by 1GM2015
  • @GM2015 said:
    Wordpress by default uses mysql's default db storage engine, which is innodb

    WordPress uses whatever you set as default in your config file. Your sites should run fine with MyISAM as the default engine.

    Post your my.cnf here.

    Thanked by 1GM2015
  • Okay, this is .my.cnf from ubuntu 14.04 I run with serverpilot with digitalocean london:
    .my.cnf:

    [client]
    port        = 3306
    socket      = /var/run/mysqld/mysqld.sock
    
    [mysqld_safe]
    socket      = /var/run/mysqld/mysqld.sock
    nice        = 0
    
    [mysqld]
    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
    interactive_timeout=300
    wait_timeout=300
    
    bind-address        = 127.0.0.1
    key_buffer      = 8M
    max_allowed_packet  = 16M
    thread_stack        = 128K
    thread_cache_size       = 4
    myisam-recover         = BACKUP
    #max_connections        = 100
    #table_cache            = 64
    #thread_concurrency     = 10
    #
    # * Query Cache Configuration
    #
    query_cache_limit   = 512K
    query_cache_size        = 8M
    #general_log_file        = /var/log/mysql/mysql.log
    #general_log             = 1
    log_error = /var/log/mysql/error.log
    #log_slow_queries   = /var/log/mysql/mysql-slow.log
    #long_query_time = 2
    #log-queries-not-using-indexes
    #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
    
    [mysqldump]
    quick
    quote-names
    max_allowed_packet  = 16M
    
    
    [isamchk]
    key_buffer      = 16M
    
    !includedir /etc/mysql/conf.d/
    
    

    Top output:

    top - 12:44:47 up 7 days, 17:31,  2 users,  load average: 0.21, 0.15, 0.23
    Tasks:  96 total,   2 running,  94 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  5.0 us,  1.2 sy,  0.0 ni, 93.3 id,  0.0 wa,  0.0 hi,  0.4 si,  0.0 st
    KiB Mem:   1017880 total,   907924 used,   109956 free,    25648 buffers
    KiB Swap:   524284 total,   180792 used,   343492 free.   440840 cached Mem
    
      PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                         
      767 mysql     20   0  872940 181184   2040 S  3.1 17.8 245:50.98 mysqld                                                          
    19366 serverp+  20   0  446048  70880  13172 S  6.6  7.0   0:01.29 php-fpm                                                         
     1445 memcache  20   0  395684  66464    112 S  1.2  6.5  81:57.98 memcached                                                       
    19367 serverp+  20   0  468756  23464  16940 S  0.0  2.3   0:00.22 php-fpm                                                         
    19365 serverp+  20   0  392932  21760  15344 S  0.0  2.1   0:00.78 php-fpm                                                         
    19369 serverp+  20   0  468708  20284  14064 S  0.8  2.0   0:00.16 php-fpm                                                         
     9389 www-data  20   0 1008892   7740   1196 S  0.0  0.8   0:14.62 httpd                                                           
     9564 www-data  20   0 1010204   7428   1004 S  0.0  0.7   0:15.84 httpd                                                           
     1191 root      20   0  168688   7116   2324 S  0.4  0.7   3:38.25 sp-agent                                                        
     9390 www-data  20   0 1007944   7056   1080 S  0.0  0.7   0:15.96 httpd                                                           
     9393 www-data  20   0 1008684   5532   1204 S  0.0  0.5   0:15.65 httpd                                                           
    19271 root      20   0  103556   4128   3164 S  0.0  0.4   0:00.01 sshd                                                            
     1530 www-data  20   0  113560   4124   2560 S  0.0  0.4   2:54.10 nginx                                                           
     1528 www-data  20   0  113452   3972   2596 S  0.0  0.4   3:09.80 nginx                                                           
    19328 1001      20   0   22656   3804   1744 S  0.0  0.4   0:00.08 bash                                                            
     1531 www-data  20   0  112420   3784   2352 S  0.0  0.4   6:07.67 nginx                                                           
     1474 newrelic  20   0  251480   3724   1920 S  0.0  0.4   9:10.45 nrsysmond                                                       
     1529 www-data  20   0  113776   3560   2280 S  0.0  0.3   3:32.62 nginx                                                           
    19327 1001      20   0  103556   1900    928 S  0.0  0.2   0:00.02 sshd   
    

    free -h

                 total       used       free     shared    buffers     cached
    Mem:          994M       891M       102M        90M        25M       434M
    -/+ buffers/cache:       431M       562M
    Swap:         511M       176M       335M
    

    Dacentec's OVZ server:
    my.cnf:

    # This will be passed to all mysql clients
    # It has been reported that passwords should be enclosed with ticks/quotes
    # escpecially if they contain "#" chars...
    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    [client]
    port        = 3306
    socket      = /var/run/mysqld/mysqld.sock
    
    # Here is entries for some specific programs
    # The following values assume you have at least 32M ram
    
    # This was formally known as [safe_mysqld]. Both versions are currently parsed.
    [mysqld_safe]
    socket      = /var/run/mysqld/mysqld.sock
    nice        = 0
    
    [mysqld]
    #
    # * 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
    lc_messages = en_US
    skip-external-locking
    interactive_timeout=300
    wait_timeout=300
    
    #
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    #bind-address       = 127.0.0.1
    skip-networking
    #
    # * Fine Tuning
    #
    max_connections     = 100
    connect_timeout     = 5
    wait_timeout        = 600
    max_allowed_packet  = 16M
    thread_cache_size       = 128
    sort_buffer_size    = 4M
    bulk_insert_buffer_size = 16M
    tmp_table_size      = 32M
    max_heap_table_size = 32M
    #
    # * MyISAM
    #
    # This replaces the startup script and checks MyISAM tables if needed
    # the first time they are touched. On error, make copy and try a repair.
    myisam_recover          = BACKUP
    key_buffer_size     = 128M
    #open-files-limit   = 2000
    table_open_cache    = 400
    myisam_sort_buffer_size = 512M
    concurrent_insert   = 2
    read_buffer_size    = 2M
    read_rnd_buffer_size    = 1M
    #
    # * Query Cache Configuration
    #
    # Cache only tiny result sets, so we can fit more in the query cache.
    query_cache_limit       = 128K
    query_cache_size        = 64M
    # for more write intensive setups, set to DEMAND or OFF
    #query_cache_type       = DEMAND
    #
    # * 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 logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
    #
    # we do want to know about network errors and such
    log_warnings        = 2
    #
    # Enable the slow query log to see queries with especially long duration
    #slow_query_log[={0|1}]
    slow_query_log_file = /var/log/mysql/mariadb-slow.log
    long_query_time = 10
    #log_slow_rate_limit    = 1000
    log_slow_verbosity  = query_plan
    
    #log-queries-not-using-indexes
    #log_slow_admin_statements
    #
    # 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
    #report_host        = master1
    #auto_increment_increment = 2
    #auto_increment_offset  = 1
    log_bin         = /var/log/mysql/mariadb-bin
    log_bin_index       = /var/log/mysql/mariadb-bin.index
    # not fab for performance, but safer
    #sync_binlog        = 1
    expire_logs_days    = 10
    max_binlog_size         = 100M
    # slaves
    #relay_log      = /var/log/mysql/relay-bin
    #relay_log_index    = /var/log/mysql/relay-bin.index
    #relay_log_info_file    = /var/log/mysql/relay-bin.info
    #log_slave_updates
    #read_only
    #
    # If applications support it, this stricter sql_mode prevents some
    # mistakes like inserting invalid dates etc.
    #sql_mode       = NO_ENGINE_SUBSTITUTION,TRADITIONAL
    #
    # * 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!
    default_storage_engine  = InnoDB
    # you can't just change log file size, requires special procedure
    #innodb_log_file_size   = 50M
    innodb_buffer_pool_size = 256M
    innodb_log_buffer_size  = 8M
    innodb_file_per_table   = 1
    innodb_open_files   = 400
    innodb_io_capacity  = 400
    innodb_flush_method = O_DIRECT
    #
    # * 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
    
    #
    # * Galera-related settings
    #
    [galera]
    # Mandatory settings
    #wsrep_provider=
    #wsrep_cluster_address=
    #binlog_format=row
    #default_storage_engine=InnoDB
    #innodb_autoinc_lock_mode=2
    #bind-address=0.0.0.0
    #
    # Optional setting
    #wsrep_slave_threads=1
    #innodb_flush_log_at_trx_commit=0
    
    [mysqldump]
    quick
    quote-names
    max_allowed_packet  = 16M
    
    [mysql]
    #no-auto-rehash # faster start of mysql but no tab completition
    
    [isamchk]
    key_buffer      = 16M
    
    #
    # * IMPORTANT: Additional settings that can override those from this file!
    #   The files must end with '.cnf', otherwise they'll be ignored.
    #
    !includedir /etc/mysql/conf.d/
    
    

    TOP output:

    Tasks:  29 total,   1 running,  28 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    KiB Mem:    524288 total,   457984 used,    66304 free,        0 buffers
    KiB Swap:   262144 total,   107820 used,   154324 free.   345948 cached Mem
    
      PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                            
     6742 mysql     20   0  976628 113744   4808 S  0.0 21.7  12:24.52 mysqld                                                             
     2425 memcache  20   0   85212  30192    868 S  0.0  5.8   0:03.88 memcached                                                          
     3159 root      20   0   99464   4456   1568 S  0.0  0.8   0:00.12 php5-fpm                                                           
     3123 root      20   0   11140   3496   2744 S  0.0  0.7   0:00.13 sshd                                                               
     2789 root      20   0   11004   3116   2644 S  0.0  0.6   0:00.03 sshd                                                               
     3200 www-data  20   0    6884   2024    932 S  0.0  0.4   0:00.14 nginx                                                              
     3132 root      20   0    5156   1940   1520 S  0.0  0.4   0:00.02 bash                                                               
    23373 root      20   0    5972   1900   1468 S  0.0  0.4   0:17.65 openvpn                                                            
     2799 1002      20   0    5104   1896   1528 S  0.0  0.4   0:00.08 bash                                                               
     2798 1002      20   0   11004   1536   1012 S  0.0  0.3   0:00.08 sshd                                                               
     3352 root      20   0    4748   1344   1020 R  0.0  0.3   0:00.00 top                                                                
     3197 root      20   0    6412    892    292 S  0.0  0.2   0:00.00 nginx                                                              
    23129 root      20   0   36820    800    572 S  0.0  0.2   0:00.26 rsyslogd                                                           
    22878 message+  20   0    4936    772    612 S  0.0  0.1   0:00.10 dbus-daemon                                                        
        1 root      20   0    3144    568    292 S  0.0  0.1   0:01.38 init                                                               
    22645 root      20   0    4640    532    404 S  0.0  0.1   0:00.44 cron                                                               
    23255 root      20   0    7796    364    256 S  0.0  0.1   0:00.15 sshd                                                               
     6743 root      20   0    3188    244    188 S  0.0  0.0   0:00.00 logger                                                             
     6526 root      20   0    4520     16     12 S  0.0  0.0   0:00.02 mysqld_safe                                                        
      104 root      20   0    2392      8      4 S  0.0  0.0   0:00.02 upstart-udev-br                                                    
     1756 root      20   0    1972      8      4 S  0.0  0.0   0:00.00 getty                                                              
     1758 root      20   0    1972      8      4 S  0.0  0.0   0:00.00 getty                                                              
     9504 root      20   0    9916      8      4 S  0.0  0.0   0:00.00 udevd                                                              
     9525 root      20   0    9916      8      4 S  0.0  0.0   0:00.00 udevd                                                              
    32236 root      20   0    2756      8      4 S  0.0  0.0   0:00.00 xinetd                                                             
      270 root      20   0    2384      4      0 S  0.0  0.0   0:00.00 upstart-socket-                                                    
    23035 root      20   0    4824      4      0 S  0.0  0.0   0:00.00 uuidd                                                              
        2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd/1333                                                      
        3 root      20   0       0      0      0 S  0.0  0.0   0:00.00 khelper/1333  
    

    free -h

                 total       used       free     shared    buffers     cached
    Mem:          512M       446M        65M        69M         0B       337M
    -/+ buffers/cache:       108M       403M
    Swap:         256M       105M       150M
    

    Setting Php5-fpm to ondemand pushed down memory usage a bit, but it's still swapping.

    angrysnarl said: Post your my.cnf here.

  • Your buffers are way too high and you're using InnoDB. Disable it, use MyISAM instead. Check out the links @rm_ posted.

    Thanked by 1GM2015
  • Add this and it should be good.

    ignore-builtin-innodb
    default-storage-engine = aria
    
    Thanked by 2GM2015 AlbaHost
  • Nobody mentioned commenting innodb lines out and I wondered why the hell trying to ignore innodb didn't let mysql to restart.

    budi1413 said: ignore-builtin-innodb default-storage-engine = aria

Sign In or Register to comment.