LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   limit cpu usage by mysql (https://www.linuxquestions.org/questions/linux-software-2/limit-cpu-usage-by-mysql-178555/)

eduac 05-06-2004 09:22 AM

limit cpu usage by mysql
 
hi fellas,

anybody has a idea to limit the cpu usage by mysqld? because sometimes the mysqld take 97% - 99% of CPU resources.

my server have:
2.8Ghz Pentium4
1GB RAM
40GB HD
GNU/Debian 3.0r1
Kernel 2.6.4

RolledOat 05-06-2004 10:30 AM

I assume that you want to limit it because it is taking away from what you want to do, making your desktop sluggish, etc. If so, you can renice (or kill and start with the nice command) with a positive value. Every process in linux has a niceness value. You can see it yoursefl with top. I would expect that mysql starts with the default 0, which means it has the same priority as most everything else. If you give it a nice of say, 10, it will 'get out of the way' of most other processes with a higher priority and use less CPU time.

man nice
man renice

RO

eduac 05-06-2004 02:40 PM

did u have a example of configuration in /etc/mysql/my.cnf ? because i think the nice is not the answer for this problem.

bpapiiro 06-08-2004 05:08 PM

hi,

I have an issue which is not like that. I wish the MySQL to use more than 24.9 from CPU time but it refuse to do that. If I try to send many queryes to mysql it comes slowly but it do not use more than 24.9 from cpu time. Can anybody give me a solution?

my.cnf
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
datadir=/var/lib/mysql
skip-locking
skip-name-resolve
set-variable = key_buffer=256M
set-variable = max_allowed_packet=1M
set-variable = table_cache=256
set-variable = sort_buffer=1M
set-variable = record_buffer=1M
set-variable = myisam_sort_buffer_size=64M
set-variable = thread_cache=500
# Try number of CPU's*2 for thread_concurrency
set-variable = thread_concurrency=8
set-variable = myisam_sort_buffer_size=64M
log-bin
server-id = 1


# Point the following paths to different dedicated disks
tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname

[mysqldump]
quick
set-variable = max_allowed_packet=16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
safe-updates

[isamchk]
set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

[myisamchk]
set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

[mysqlhotcopy]
interactive-timeout

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


All times are GMT -5. The time now is 06:48 AM.