473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

MYSQL performance issue

Hi,
The following prg keeps cpu usage as 79% always .When i kill/stop the
prg,then cpu comes down.

main()
{
//code for mysql conn
while(1)
mysql_real_query (&mysqlcon, "SET CHARACTER SET 'utf8';", 25);
}

What might be the reason? Wil it be any config issues?

Regards,
sathis

Mar 6 '07 #1
3 2607
kanna wrote:
Hi,
The following prg keeps cpu usage as 79% always .When i kill/stop the
prg,then cpu comes down.

main()
{
//code for mysql conn
while(1)
mysql_real_query (&mysqlcon, "SET CHARACTER SET 'utf8';", 25);
}

What might be the reason?
What do you expect the cpu usage to be when you call a function in a
loop that never ends?
Mar 6 '07 #2
On Mar 6, 2:28 pm, Aggro <spammerdr...@yahoo.comwrote:
kanna wrote:
Hi,
The following prg keeps cpu usage as 79% always .When i kill/stop the
prg,then cpu comes down.
main()
{
//code for mysql conn
while(1)
mysql_real_query (&mysqlcon, "SET CHARACTER SET 'utf8';", 25);
}
What might be the reason?

What do you expect the cpu usage to be when you call a function in a
loop that never ends?
I undertand that cpu usage wil go up for the above prg.
But cld nt understnad, why it goes very high.

Mar 7 '07 #3
kanna wrote:
>What do you expect the cpu usage to be when you call a function in a
loop that never ends?

I undertand that cpu usage wil go up for the above prg.
But cld nt understnad, why it goes very high.
Ok, try this simple example. Raise your hand as quicly as you can and
then lower it as quicly as you can. Now repeat this in endless loop as
fast as you can.

Rasing and lowering your hand is the function. If you repeat this
function in an endless loop without any rest, you should soon find out
that your cpu is turning pretty hot.

If you want to have an endless loop (which is very rare that people
actually want that, unless they don't know what they are doing), you
could add a small rest ( usually done with sleep()-function, but depends
on the programming language ) between the function calls. This would
lower the cpu usage percent dramatically.
Mar 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Google Mike | last post by:
To my surprise last month, my dad wanted to start dabbling in PHP and MySQL or pgSQL. I've been helping him out a bit. He's into athletic medicine and wants to have a website to help athletes and...
10
by: Marcus | last post by:
Quick question on how I setup my mysql database(s)... If my setup is such that I have multiple clients, and each client gets 10 tables to store their data, is it better for performance if I put...
13
by: jamie howard | last post by:
Hello there - we have a fairly busy server and we just started to have problems with PHP sessions failing. We've never had this problem before and to be honist, out server traffic is lower than it...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
0
by: Forecast | last post by:
I am using the MySQL++, MySQL 4 in MS Visual C++ 6.0. When I try to compile the program, warning occurs (see below). Besides, the program have runtime error as follows: "The procedure entry point...
33
by: Joshua D. Drake | last post by:
Hello, I think the below just about says it all: http://www.commandprompt.com/images/mammoth_versus_dolphin_500.jpg Sincerely, Joshua Drake
39
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
0
by: Sam Flywheel | last post by:
Hello, all: I am pleased to announce that the MySQL Journal is moving forward. During the past two weeks, I've been discussing the journal with MySQL AB, and the plan that's been devised...
6
by: onnodb | last post by:
Hi all, While working on an Access UI to a MySQL database (which should be a reasonable, low-cost, flexible interface to the DB, better than web-based, much less costly than a full-fledged .NET...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.