mysqldump slowing down the process?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users mysqldump slowing down the process?
# 1  
Old 04-07-2009
Java mysqldump slowing down the process?

Hi All,

I have a data calculation process-a perl script running each and every hour which will do some calculations on the data stored in a mysql server. Normally it tooks around 2minutes (max) to complete.

But in case if i did any actions on the linux box where the database is hosted, it is slowing down the process so as to finish the job in 30-50 minutes. I am just doing a mysqldump in the early hours of morning which is slowing down the very next process run. The process run is starting slowly but picking up it's speed and will finish up in it's own fashion, but overall 30-50 minutes it will consume.

I tried to do some optimization on the db server, moved the db server to a different box apart from where the perl script is running ie, loadserver but no change. I also noticed the io% consumed while the job is running and it is too high initially when the process start, then slows down gradually.

Here goes the version information:

Code:
MySQL:
        version    :   5.0.51a-24
        version_comment   :  (Debian)
        version_compile_machine :  i486
        version_compile_os  : debian-linux-gnu

Kernel version: 2.6.26-1-686 #1 SMP
Operating System: Debian 5.0 (lenny)

Can anyone face the similar scenario? Any ideas on this? Your help is very much appreciated!

With Regards
Dileep Pattayath
# 2  
Old 04-08-2009
First, please post the output of these mysql utilities (please use code tags when you post the output):

https://www.unix.com/web-programming-...primer-sh.html
# 3  
Old 04-08-2009
Java

Thanks for your repsone Neo.

Here goes the output of mysqltuner.pl
Code:
 >>  MySQLTuner 1.0.0 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: 
 
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-24
[!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM
 
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in MyISAM tables: 4G (Tables: 20)
[!!] InnoDB is enabled but isn't being used
[!!] Total fragmented tables: 1
 
-------- Performance Metrics -------------------------------------------------
[--] Up for: 10h 53m 40s (2M q [73.287 qps], 2K conn, TX: 1B, RX: 1B)
[--] Reads / Writes: 57% / 43%
[--] Total buffers: 1.1G global + 12.3M per thread (250 max threads)
[!!] Allocating > 2GB RAM on 32-bit systems can cause system instability
[!!] Maximum possible memory usage: 4.1G (109% of installed RAM)
[OK] Slow queries: 0% (5/2M)
[OK] Highest usage of available connections: 29% (73/250)
[OK] Key buffer size / total MyISAM indexes: 1.0G/658.7M
[OK] Key buffer hit rate: 99.5% (66M cached / 359K reads)
[!!] Query cache efficiency: 6.8% (115K cached / 1M selects)
[!!] Query cache prunes per day: 224366
[OK] Sorts requiring temporary tables: 0% (1 temp sorts / 769K sorts)
[OK] Temporary tables created on disk: 0% (48 on disk / 312K total)
[OK] Thread cache hit rate: 81% (476 created / 2K connections)
[OK] Table cache hit rate: 91% (65 open / 71 opened)
[OK] Open file limit used: 7% (102/1K)
[OK] Table locks acquired immediately: 99% (2M immediate / 2M locks)
 
-------- Recommendations -----------------------------------------------------
General recommendations:
    Add skip-innodb to MySQL configuration to disable InnoDB
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Enable the slow query log to troubleshoot bad queries
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_limit (> 1M, or use smaller result sets)
    query_cache_size (> 32M)

Output of tuning-primer.sh
Code:
mysqld is alive
 
        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -
 
MySQL Version 5.0.51a-24 i486
 
Uptime = 0 days 10 hrs 56 min 36 sec
Avg. qps = 73
Total Questions = 2880082
Threads Connected = 32
 
Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations
 
To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service
 
SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 5 out of 2880109 that take longer than 10 sec. to complete
Your long_query_time may be too high, I typically set this under 5 sec.
 
BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html
 
WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 0
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
 
MAX CONNECTIONS
Current max_connections = 250
Current threads_connected = 33
Historic max_used_connections = 73
The number of used connections is 29% of the configured maximum.
Your max_connections variable seems to be fine.
 
MEMORY USAGE
Max Memory Ever Allocated : 1.91 G
Configured Max Per-thread Buffers : 3.00 G
Configured Max Global Buffers : 1.04 G
Configured Max Memory Limit : 4.04 G
Physical Memory : 3.71 G
 
Max memory limit exceeds 90% of physical memory
 
KEY BUFFER
568333 * 1024 / 1073741824 * 100
Current MyISAM index space = 658 M
Current key_buffer_size = 1.00 G
Key cache miss rate is 1 : 183
Key buffer free ratio = 0 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere
 
QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 1 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 5.96 %
Current query_cache_min_res_unit = 4 K
Query Cache is 21 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size
 
SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 7 M
Sort buffer seems to be fine
 
JOINS
Current join_buffer_size = 132.00 K
You have had 2 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.
 
Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.
 
OPEN FILES LIMIT
Current open_files_limit = 1284 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine
 
TABLE CACHE
Current table_cache value = 512 tables
You have a total of 37 tables
You have 65 open tables.
The table_cache value seems to be fine
 
TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 312629 temp tables, 0% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine
 
TABLE SCANS
Current read_buffer_size = 1 M
Current table scan ratio = 23 : 1
read_buffer_size seems to be fine
 
TABLE LOCKING
Current Lock Wait ratio = 1 : 2111
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.

With Regards
Dileep Pattayath
# 4  
Old 04-08-2009
Do you know what are your first steps based on these basic tuning results?
# 5  
Old 04-08-2009
Java

I understand some of them, but not sure how to proceed with this. I am expecting some guidence from you if you dont mind please..
# 6  
Old 04-08-2009
No problem at all. I just wanted to get your ideas first, so we can have a two-way dialog, not just one way.

First, I suggest you decrease your maximum number of SQL connections to 100 to save memory, since you are very low on memory, according to the tuning scripts.

At the same time you do this increase your query cache size to 128 MB, as a first step.

Do you know how to do this?
# 7  
Old 04-08-2009
ok, i will increase my query cache to 128mb as you said.The number of connections was 100 before and i modified it few days ago after i faced an issue with the connection limit. The figure the script is showing (74) is because i restarted my server yesterday early morning. What else i was supposed to do?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Help with automatically Import from special mysqldump

Hi @ all I need a little bit help with a tricky problem ... Here´s the situation: We´ve 2 MySQL-Servers, one is productive, the other is Backup. At the productive Server there runs every 2 hours a cron Job which does a Dump from MySQL-DB with script 'automysqlbackup.sh' and copy it then... (7 Replies)
Discussion started by: jackcracker
7 Replies

2. UNIX for Advanced & Expert Users

awk slowing down -- why?

I have an awk script that extracts data from log files and generates a report. The script is incrementing elements in arrays, summing fields depending on contents of other fields, and then in END performing some operations on those arrays. It seemed to be taking longer than it should on my... (6 Replies)
Discussion started by: treesloth
6 Replies

3. Shell Programming and Scripting

Mysqldump rotate backup

I have a very simple script that uses a cron job to take a daily backup of our orders database. echo "Dumping ORDERS database"; mysqldump -u root --password='mypassword' -h '1.1.1.1' --opt --compress ORDERS $tbl_names > /Volumes/Files_Backup_1/db_backups/orders.sql echo "Copied database to... (2 Replies)
Discussion started by: timgolding
2 Replies

4. Shell Programming and Scripting

Expect slowing down / missing characters

Im writing an expect program to connect to cisco routers and run commands. my commands file has only two entries show version show running-config when I run the script, the first command is run without a problem. The second command isn't. The "s" is missing at the device command line,... (1 Reply)
Discussion started by: popeye
1 Replies

5. UNIX for Dummies Questions & Answers

Mysqldump certain tables

Hi, I have to upload part of my database periodically when i make changes to product data etc. However I only want to upload certain tables. We suffer from bandwidth chock here, so i want to write a couple of separate scripts that upload parts of the database that changed. The database is large... (5 Replies)
Discussion started by: timgolding
5 Replies

6. UNIX for Dummies Questions & Answers

Sendmail process "Toomany" system slowing down

Hello Experts I have M4000 Solaris 10 server, from few many days there are too many sendmail and mail.local process starting on server and each time i need to kill mannualy using pkill send mail, some time there will 600 of them taking 30mb memory for each and hence slowing down the server,... (2 Replies)
Discussion started by: karghum
2 Replies

7. UNIX for Dummies Questions & Answers

Problem with my crontab file, using mysqldump

My crontab file tells cron to run a certain shell script at 10:30 AM every day. The shell script backs up my database with mysqldump and then runs a sed script that does some editing of the backup file. I have programmed the shell script to write an error message to a file I have in my home... (1 Reply)
Discussion started by: Ultrix
1 Replies

8. Shell Programming and Scripting

Help needed for mysqldump command

I want to take a backup of a database and redirect the output of the whole process to a log file. I am using the below command: mysqldump -A --add-drop-table > mysql-daily-backup.sql &> /tmp/backup_log/mysql.log Is there anything wrong with the syntax? ---------- Post updated at 08:32 PM... (0 Replies)
Discussion started by: proactiveaditya
0 Replies

9. Shell Programming and Scripting

mysqldump script without hardcode password

OS: Linux ambglx02 2.6.16.60-0.21-default #1 Tue May 6 12:41:02 UTC 2008 i686 i686 i386 GNU/Linux Shell: bash Currently I have a mysqldump script to backup my mysql database, the command is as below: /opt/novell/mysql/bin/mysqldump --add-drop-table -u root -p -h mydb > /home/john/mydb.sql ... (5 Replies)
Discussion started by: bulkbiz
5 Replies
Login or Register to Ask a Question