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.
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
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
topsorted by memory usage (shift-M)how much traffic is it?
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 sshdNew 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.
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).
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.
Okay, this is .my.cnf from ubuntu 14.04 I run with serverpilot with digitalocean london:
.my.cnf:
Top output:
free -h
total used free shared buffers cached Mem: 994M 891M 102M 90M 25M 434M -/+ buffers/cache: 431M 562M Swap: 511M 176M 335MDacentec'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/1333free -h
total used free shared buffers cached Mem: 512M 446M 65M 69M 0B 337M -/+ buffers/cache: 108M 403M Swap: 256M 105M 150MSetting Php5-fpm to ondemand pushed down memory usage a bit, but it's still swapping.
Your buffers are way too high and you're using InnoDB. Disable it, use MyISAM instead. Check out the links @rm_ posted.
Add this and it should be good.
Nobody mentioned commenting innodb lines out and I wondered why the hell trying to ignore innodb didn't let mysql to restart.