我正在使用digitalocean $ 5计划。
1个CPU,512MB内存,mysql + apache,nginx + centos 6.5 + cpanel安装。 那2个wordpress站点。
但是,如果我重新加载我的网站之一的网页,CPU使用率增加到50%,60%。如果我检查来自woorank(search引擎优化分析器)mysite,我的服务器崩溃,CPU和RAM使用率增加到100%。 这些网站不是那么大。 我可以说新的。 我能做些什么呢? 在共享主机上,我获得了更多的性能。
离开:
Htop,当我刷新我的任何一个WordPress的网站:
我正在使用wp-supercaching,cloudflare.Not这么多的插件只安装了必要的。
这是my.cnf
[mysqld] port = 3306 socket = /var/lib/mysql/mysql.sock default-storage-engine=MYISAM max_connections = 50 key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 1000 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_cache_size = 128 query_cache_type = 1 query_cache_size = 16M query_cache_limit = 1M log-slow-queries= /var/lib/mysql/slow.log log-error = /var/lib/mysql/error.log expire_logs_days = 10 max_binlog_size = 100M # For low memory, InnoDB should not be used so keep skip-innodb uncommented unless required skip-innodb # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = /var/lib/mysql/ #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = /var/lib/mysql/ #innodb_log_arch_dir = /var/lib/mysql/ # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size #innodb_log_file_size = 5M #innodb_log_buffer_size = 8M #innodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = 50 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 8M sort_buffer_size = 8M [myisamchk] key_buffer = 8M sort_buffer_size = 8M [mysqlhotcopy] interactive-timeout
这是我的Apacheconfiguration:
Start Servers : 1 Min. Spare Servers: 5 Max. Spare Servers: 10 Server limit : 256 Max clients : 15 Max request per child :10000 Keep-alive : ON Keep-alive timeout: 15 Max keep alive request: 100 Timeout: 300
5美元的虚拟机无法保存完整的cPanel安装。
几点build议:
如果你打算使用这个cPanel虚拟主机,我会考虑使用更大的虚拟机(甚至多个更大的虚拟机)。
网站本身可能不是那么大,但只是运行Apache(和PHP)和MySQL和操作系统可以超过你分配的内存(你在做什么,看你的交换使用),如果你不采取措施来优化和保持事情很小。 现在512MB并没有让你走得很远,尤其是在缺省设置下使用php和apache。
研究优化您的程序以减less内存占用,并将活动进程/监听程序减less到最低程度。 如果你要在一个embedded式的机器上运行,你必须像embedded式机器一样运行它,或者上$ 10的计划。