473,406 Members | 2,217 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.

Consistency among multiple connections

Hi everybody,

I have the following scenario. Several computers with shared disk in a
LAN. Each of these computer has a MySQL server that serves several
databases. I have several clients that communicate with a Java process
that I have in each computer to answer queries for a given database
(it connects to the MySQL server). I also have a Java process that
updates continuously the databases; this process executes only in the
local computer: it takes advantage from the fact that the disk is
shared in order to update all the databases as quick as possible when
it is needed.

I am observing some problems:

1) It seems to be a consistency problem. Updates that are performed by
the process that updates the databases are not always seen by the
clients.

2) Sometimes, it seems that some tables get corrupted, as clients get
errors relative to the table handler.

Do I need to do something special to ensure the consistency? Does this
scenario make sense to you? I know that I could use different
processes in each computer to perform the updates (not taking
advantage of the shared disk) but then I would have to synchronize
these processes to perform the updates at the same time (the updates
are the result of a simulation, and they must be performed at specific
relative times).

Thanks in advance for any suggestion,

Sergio
Jul 20 '05 #1
1 2002
Sergio wrote:
it takes advantage from the fact that the disk is
shared in order to update all the databases as quick as possible when
it is needed.
Well, quick is nice, but if you're occasionally causing corruption, the
time taken to recover the database probably puts a dent in any
performance advantage. ;-)
1) It seems to be a consistency problem. Updates that are performed by
the process that updates the databases are not always seen by the
clients.
Each instance of mysqld keeps a cache containing recent modifications to
the database. When you do a query, mysqld may get part of the result
from disk, and also amend that with its current knowledge of updates
that haven't been written to disk yet. This means that a _second_
instance of mysqld accessing the same database directly doesn't have any
way of knowing what, if any, changes are floating in the cache of the
first instance of mysqld.
2) Sometimes, it seems that some tables get corrupted, as clients get
errors relative to the table handler.
Not surprising, given the above.
Do I need to do something special to ensure the consistency? Does this
scenario make sense to you?


This scenario is, as you have discovered, practically guaranteed to
corrupt your databases on a regular basis. I recommend strongly against
accessing databases from more than one MySQL engine. Two engines that
are not synchronizing their operations are very likely to make
conflicting updates to the files.

You said you're using Java to access MySQL. You must specify the
hostname of the database server in your JDBC URLs, so that you can let
the MySQL daemon on that host do the I/O on all the databases running
locally on that server. Like so:

Connection conn = DriverManager.getConnection(
"jdbc:mysql://mydbserver/test?user=mydbuser&password=xxxxxxxx");

This is the most reliable way (perhaps the *only* way) to run client
applications on multiple machines, and access the databases
simultaneously, without corrupting the database. That's why there is a
server hostname field in the JDBC URL!

Regards,
Bill K.
Jul 20 '05 #2

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

Similar topics

16
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
1
by: Sergio | last post by:
Hi everybody, I have the following scenario. Several computers with shared disk in a LAN. Each of these computer has a MySQL server that serves several databases. I have several clients that...
6
by: Quiet Man | last post by:
Hi all, I'm designing a fairly simple service that will run on W2K/SP4 and W2K3 servers. It's job is to be a very specialized database server that listens on a given IP address / TCP port and...
9
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated...
2
by: jasonsgeiger | last post by:
From: "Factor" <jasonsgeiger@gmail.com> Newsgroups: microsoft.public.in.csharp Subject: Multiple Clients, One port Date: Wed, 19 Apr 2006 09:36:02 -0700 I'm been working with sockets for a...
1
by: Yelena Varshal via AccessMonster.com | last post by:
Hello, What are the pre-requisites / conditions for the ability to create multiple connections to MS ACCESS database and what is the precedence of its application? adModeShareDenyNone in the code,...
3
by: D. Yates | last post by:
Hi, I'm about to embark on a project that will both send and receive information to/from our client computers in the field. The area that I still need to finalize is the method of...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
0
by: z71mdridin | last post by:
I have several vb.net common code libraries that are used throughout multiple applications in our enterprise. For example, we have code libraries to handle logging, error handling, database...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
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...

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.