473,473 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1520
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...
4
by: sracherla | last post by:
I am trying to write a simple windows service that accepts an incoming request; receives a string input and sends a string output. I need this connection to stay alive until the client closes it....
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: 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
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...
1
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.