Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The server has 24 GB of memory and 4 quad-core cpu's. It runs a busy website on apache/MySQL/php and sometimes gives a message that the server load is too high. When I look at the logs it never uses more then 3 GB of memory which seems strange too me. This could be a MySQL or apache setting.

Here some data

uname -a
Linux s2274 2.6.32-32-server #62-Ubuntu SMP Wed Apr 20 22:07:43 UTC 2011 x86_64 GNU/Linux


free -m
             total       used       free     shared    buffers     cached
Mem:         24153      20951       3201          0        125      17719
-/+ buffers/cache:       3106      21046
Swap:        11240         14      11226

As you can see it says here that there is 20 GB in use. But when I look at top/htop it never comes above 3092 usage. The processors are not really active, average load is 0.9. Could I increase somehow the memory that is used by apache and/or MySQL to see if it can use alle memory?


Sorry, i was away for a while..... Here is the output from the mysqld command:

120108  8:48:21 [Note] Plugin 'FEDERATED' is disabled.
  --binlog_cache_size=#
  --bulk_insert_buffer_size=#
  --delayed_queue_size=#
  --join_buffer_size=#
  --key_buffer_size=# The size of the buffer used for index blocks for MyISAM
  --key_cache_block_size=#
  --max_binlog_cache_size=#
  --max_binlog_size=# Binary log will be rotated automatically when the size
                      max_relay_log_size is 0. The minimum value for this
  --max_heap_table_size=#
  --max_join_size=#   Joins that are probably going to read more than
                      max_join_size records return an error.
  --max_relay_log_size=#
                      the size exceeds max_binlog_size. 0 excepted, the minimum
  --myisam_block_size=#
  --myisam_data_pointer_size=#
  --myisam_max_extra_sort_file_size=#
  --myisam_max_sort_file_size=#
  --myisam_sort_buffer_size=#
  --preload_buffer_size=#
  --profiling_history_size=#
  --query_alloc_block_size=#
  --query_cache_size=#
  --query_prealloc_size=#
  --range_alloc_block_size=#
  --read_buffer_size=#
  --read_rnd_buffer_size=#
  --record_buffer=#   Alias for read_buffer_size
  --sort_buffer_size=#
  --thread_cache_size=#
  --tmp_table_size=#  If an internal in-memory temporary table exceeds this
  --transaction_alloc_block_size=#
--transaction_prealloc_size=#
binlog_cache_size                 32768
bulk_insert_buffer_size           8388608
delayed_queue_size                1000
join_buffer_size                  12582912
key_buffer_size                   805306368
key_cache_block_size              1024
max_binlog_cache_size             18446744073709547520
max_binlog_size                   104857600
max_heap_table_size               805306368
max_join_size                     18446744073709551615
max_relay_log_size                0
myisam_block_size                 1024
myisam_data_pointer_size          6
myisam_max_extra_sort_file_size   2147483648
myisam_max_sort_file_size         9223372036853727232
myisam_sort_buffer_size           25165824
preload_buffer_size               32768
profiling_history_size            15
query_alloc_block_size            8192
query_cache_size                  805306368
query_prealloc_size               8192
range_alloc_block_size            4096
read_buffer_size                  25165824
read_rnd_buffer_size              25165824
sort_buffer_size                  25165824
thread_cache_size                 256
tmp_table_size                    805306368
transaction_alloc_block_size      8192
transaction_prealloc_size         4096

The php memory_limit is 128M

I see that 3 gb limit in several situations. F.i. Htop, top and when I log in to Webmin in the server status.( yes I use Webmin since I do a lot of management from my iPad ;))

I will try to add a screenshot here...

share|improve this question
3  
3 GB reminds me to the max memory available to 32-bit applications. Could you provide information about the versions of MySQL, Apache and PHP you've running? Which software caused the "Load too high" message? Log file entries? What are the memory settings of MySQL (output of mysqld --verbose --help | grep _size)? PHP's memory_limit config option? –  tohuwawohu Nov 26 '11 at 10:15
2  
What exactly are you looking at that says 3092 usage? A screenshot with a highlight may prove helpful. From free your server looks fine. –  Caesium Nov 26 '11 at 10:42
1  
I think we need to understand which process you are seeing from Htop that is using the 3092 of usage. If Apache is getting hit really hard by the number of concurrent connections it may be spawning a number of child processes. –  Justin Andrusk Dec 16 '11 at 16:50
add comment

2 Answers 2

You are using 20951 of 24153. The applications are not requesting any more than 3092 so the kernel is using the rest for cache and buffers. As your applications need more memory, the kernel will reduce the cache to accommodate the new application requirements.

Tweaking the MySQL and Apache configuration for optimal performance depends on the application. In some cases like static web sites, a large filesystem cache is great. A dynamic site however with heavy database interaction would benefit from a few changes to the default MySQL configuration.

Percona has a nice tool to get you started with the MySQL config. http://tools.percona.com/wizard Once the basics are in, you can tweak further for the specifics of your application.

The Apache configuration depends on how much traffic and the size of the requests. Without knowing anything it's hard to recommend beyond the defaults.

share|improve this answer
add comment

If i am correct you are running a 32 bit server

32 bit is limmited to 4 gb mem unless you use the pae image:

A 32-bit computer has a word size of 32 bits, this limits the memory theoretically to 4GB. This barrier has been extended through the use of 'Physical Address Extension' (or PAE) which increases the limit to 64GB although the memory access above 4GB will be slightly slower.

i cannot find if the kernel image has pae included.

you can try do a apt-get install linux-image-generic-pae

if that is don do reboot and see if you user more of your memory.

ELse consider installing 64 bit server

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.