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 )*
where thread_buffers includes the following:
and global_buffers includes:
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...
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
> Denis Solovyov
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1