Unix Technical Forum

mysql performance

This is a discussion on mysql performance within the MySQL forums, part of the Database Server Software category; --> Hi All, I develop an application in java in that several objects are querying a database, occasionally simultaneous. I ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:27 AM
korcs
 
Posts: n/a
Default mysql performance

Hi All,

I develop an application in java in that several objects are querying
a database, occasionally simultaneous.

I think when this happens, the mysql server returns with an error
message to one of this objects.

My question is: what is the best practice when competeing objects are
using the same resource?

I was thinking on using table locks, but I am not sure whether it is
the most elegant way to solve it.

Any good experiences, ideas?

Best,

korcs

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:27 AM
Jerry Stuckle
 
Posts: n/a
Default Re: mysql performance

korcs wrote:
> Hi All,
>
> I develop an application in java in that several objects are querying
> a database, occasionally simultaneous.
>
> I think when this happens, the mysql server returns with an error
> message to one of this objects.
>
> My question is: what is the best practice when competeing objects are
> using the same resource?
>
> I was thinking on using table locks, but I am not sure whether it is
> the most elegant way to solve it.
>
> Any good experiences, ideas?
>
> Best,
>
> korcs
>


What kind of error are you getting? What do you mean by competing
objects are "using the same resource"? That is, what resource?

MySQL handles concurrent requests quite well.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:27 AM
Gordon Burditt
 
Posts: n/a
Default Re: mysql performance

>I develop an application in java in that several objects are querying
>a database, occasionally simultaneous.


>I think when this happens, the mysql server returns with an error
>message to one of this objects.


The normal MySQL response to two requests that conflict is to make
one wait, so they happen as though one came after the other. If,
for example, you are trying with two different requests to insert
a record with the same primary key, and that is causing an error,
you are computing a new primary key wrong (try an auto-increment
column).

If you THINK there is an error message, try actually logging it, along
with the query that caused it and perhaps a time stamp.

>My question is: what is the best practice when competeing objects are
>using the same resource?


What resource? A table?

>I was thinking on using table locks, but I am not sure whether it is
>the most elegant way to solve it.


If you have a series of changes that need to be made all-or-nothing
without interference from something else, use transactions (and
InnoDB tables).


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:49 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com