Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-10-2005, 01:59 AM   #1
Registered: Feb 2005
Location: Romania
Distribution: Fedora 2
Posts: 38

Rep: Reputation: 15
mutlithreaded client slow mysql queries

Hello everyone.

My problem: i wrote a multithreaded app (C++) which uses mysql database (Server version : 4.1.13-standard-log, linux RedHat 8 2.4.29 #1 SMP Thu Mar 10 03:05:14 EET 2005 i686 i686 i386 GNU/Linux). Most of the treads are staying for extended amounts of time in rt_sig state. After processing several hundreds of records, queries are becoming exteremely slow. Any help, suggestion is welcome !
Old 10-10-2005, 12:33 PM   #2
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48

Rep: Reputation: 15
I have writen a multi-process app instead of a multi-threaded server app that connects to mysql server. Although it may not be exactly the same, my queries are becoming slow after some time and even having some timeouts. It turns out that I have set "max_connections" to a high number. I followed some recommnedations from mysql site regarding settings of max_conections and set it at a lower number.

The result, queries are handled well (not slow) and no timeouts. It may not be your C++ app but could be the mysql settings thats causing the problem

Hope this helps.

Old 10-10-2005, 06:58 PM   #3
LQ Newbie
Registered: Jul 2004
Distribution: whatever
Posts: 10

Rep: Reputation: 0
Are you closing your connections (or returning them to a connection pool)? Unless your queries are very long running or you have a high-throughput system you should be fine with a dozen or so connections for most uses. If your high-water-mark of open connections is higher than that, be suspicious that you are not closing them. Another hint would be if the mysql memory footprint grows and grows.
Old 10-11-2005, 01:26 AM   #4
Registered: Feb 2005
Location: Romania
Distribution: Fedora 2
Posts: 38

Original Poster
Rep: Reputation: 15
thx guys, to all of U ;-)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Thin Client speed is to slow why? banner Linux - Networking 5 04-11-2005 08:03 PM
Security risks of php based mysql queries TigerOC Linux - Security 5 04-10-2005 07:30 AM
SQL queries per page (PHP, MySQL) Silent1 Programming 2 06-27-2004 11:15 PM
OpenGL mutlithreaded problem The_Nerd Programming 1 06-25-2004 12:36 PM
MySQL queries from Shell - unexpected result philipz Programming 5 05-04-2004 05:38 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration