473,807 Members | 2,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_quer y (&mysqlcon, "SET CHARACTER SET 'utf8';", 25);
}

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

Regards,
sathis

Mar 6 '07 #1
3 2624
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_quer y (&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...@y ahoo.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_quer y (&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
2721
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 physical therapists improve performance. His current web hosting provider -- Earthlink -- doesn't give him anything but PHP 3.0.x. I want to get him at least on PHP 4.2.x (or better) along with either MySQL or PostgreSQL (pgSQL) support. I've...
10
1839
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 all of these tables into 1 large database (with a unique identifier prepended to each one) or create a separate database for each client? i.e., assuming 1000 clients, I either would have: A) 1 database and 10,000 tables in it, 10,000 total tables
13
2356
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 has been in prior months - so I'm really not sure what could cause this. Could anyone suggest some potentiol avenues to explore for reasons that could cause PHP sessions to fail? Thanks for any suggestions!
0
3953
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 version of this document can be found at: http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
0
2462
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 mysql_connect could not be located in the dynamic link library LIBMYSQL.dll" Is that I have missed any settings in MS Visual C++ 6.0/MySQL? Thx.
33
5604
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
8436
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 of stammering and sputtering, and managed to pull out something I heard a couple of years back - that there was no real transaction safety in MySql. In flight transactions could be lost.
15
4651
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 communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
0
1755
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 benefits all involved, including authors, readers, the community, and MySQL AB.  Let me outline how the journal will operate: * The name of the magazine is Tabula: The Journal of MySQL Development.
6
6269
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 app or so.... is it?), I tried measuring the bandwith consumed by the Access/MyODBC/MySQL link, which came out to be, er, quite high. I fancied it would be interesting to look at the queries Access throws at MySQL through the ODBC link, so I...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10373
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10113
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9195
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5547
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.