List:General Discussion« Previous MessageNext Message »
From:Kishore Jalleda Date:March 9 2006 7:16pm
Subject:Re: key_buffer_size and memory used by mysqld
View as plain text  
This would clear your doubt about which memory is shared by all threads and
which memory is used by individual threads ......

min_memory_needed_by_mysql  = (global_buffers + ((thread_buffers )*
max_connections)))

where thread_buffers includes the following:

sort_buffer
myisam_sort_buffer
read_buffer
join_buffer
read_rnd_buffer

                   and global_buffers includes:

key_buffer
innodb_buffer_pool
innodb_log_buffer
innodb_additional_mem_pool
net_buffer

Also its very easy to set key_buffer_size , just add up the total size of
your indexes in the mysql data dir ( *.MYI files) and set the key buffer
size approx to that, so that all your keys are in memory also you can check
your key efficiency using mytop to make any changes...

Kishore Jalleda


On 3/9/06, Denis Solovyov <elk@stripped> wrote:
>
>
> Please  explain  to  me how mysqld's "key buffer" uses memory under Linux
> (kernel 2.4, glibc 2.3, mysql 4.1).
>
> I'd  want  to  know  for  sure  if  every  mysqld thread  (forked upon an
> incoming connection) uses its own memory for key buffer (key_buffer_size)
> or key buffer is common for all mysql threads.
>
> When `ps aux` shows the something like
>
> root      2012  0.0  0.2  2712 1260 ?        S    Mar09   0:00 /bin/sh
> /usr/local/bin/mysqld_safe ...
> mysql     2062  0.0  3.4 33836 17756 ?       S    Mar09   0:02 mysqld ...
> mysql     2063  0.0  3.4 33836 17756 ?       S    Mar09   0:02 mysqld ...
> mysql     2064  0.0  3.4 33836 17756 ?       S    Mar09   0:00 mysqld ...
> mysql    14596  0.0  3.4 33836 17756 ?       S    01:58   0:00 mysqld ...
> mysql    14598  0.0  3.4 33836 17756 ?       S    01:58   0:00 mysqld ...
> mysql    14599  0.0  3.4 33836 17756 ?       S    01:59   0:00 mysqld ...
>
> does  it  mean  that every thread allocates its own megs of memory?  What
> will  happen  if there will be VERY many connections?  Will "key buffers"
> eat  all the memory quickly as the number of connections will grow,  or I
> misunderstand  `ps`  output and probably anything else?  Do I have to set
> "key_buffer_size"  to  a pretty small value if I expect many simultaneous
> connections?
>
> Denis Solovyov
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>

Thread
key_buffer_size and memory used by mysqldDenis Solovyov9 Mar
  • Re: key_buffer_size and memory used by mysqldKishore Jalleda9 Mar
    • Re[2]: key_buffer_size and memory used by mysqldDenis Solovyov11 Mar