Re: slow on open DBF(s) from network ?



On Thu, 17 Aug 2006 19:05:58 +0800,
fatfat <fatfat@xxxxxxxxxx> wrote:
but the speed is very fast when open the exclusive mode from network drive ?

Expected behavior. It's a basic optimization done by most network
client.
In EXCLUSIVE mode when you read single record Windows read in one
Network IO operation much bigger peace of data which contains more
records and then retrieves them from cache so it has to be faster.
Such tricks cannot be used in shared mode because data in cache
may not be valid when other station access files. Some networks
can in some limited way optimize also shared mode. They are using
mechanism leases. When station open file it tries to set lease lock.
Server check if the station is only one user of given file and if
it is returns success to lock operation and stations begins to use
the file as in exclusive mode. When other process try to open file
with active lease lock server stops it for a while informs the first
process/station which keeps the lock that the file cannot be longer
accessed in exclusive mode and all buffers should be discarded.
When station confirms that it switch to shared mode server unblock
the first process allowing to open file. Well implemented such
mechanism can nicely speed-up network operation without big risk
as long as is used only for read buffers. It can be also safely
used for write buffers but only if you are sure that station cannot
crush with hot buffers so it's not good idea to use it with standard
PC in LAN.
MS implemented such mechanism and call it Opportunistic Locks.
Unfortunately as many other "features" they added to Windows
it does not work as it should causing data corruption on concurrent
file access. IMHO the total cost of lost data caused by the unacceptable
quality of this code in different Windows version is comparable to
to the cost of damages done by most famous viruses.
Said that we cannot make with MS the same as US government tries to
do with virus authors ;-(

best regards,
Przemek
.



Relevant Pages

  • Re: slow on open DBF(s) from network ?
    ... It's a basic optimization done by most network ... In EXCLUSIVE mode when you read single record Windows read in one ... When station open file it tries to set lease lock. ...
    (comp.lang.clipper)
  • Re: Database path from DSN (MSDE) (2nd. attempt)
    ... it is not possible to open Access in exclusive mode. ... a lock field using MsAccess (I didn't continue testing with SQL ... BeginTrans/CommitTrans pairs during the EOD. ... >In SQL Server, have a table that has a field that indicates all uses should ...
    (microsoft.public.vc.mfc)
  • Re: TEXT datatype, transactions, and al.
    ... >> lock table counter in exclusive mode ... possibility of grabbing a duplicate value. ... and all of this was rolled into a proc. ...
    (comp.databases.sybase)
  • Re: DX Lock problem
    ... oracle dx lock commit rollback ... this exclusive mode lock of type DX, ...
    (comp.databases.oracle.server)
  • DX Lock problem
    ... We are facing some problems w/ this type of lock. ... Sometimes a session hangs after acquiring a DX lock in exclusive mode ...
    (comp.databases.oracle.server)