[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::axp-developer

Title:Alpha Developer Support
Notice:[email protected], 800-332-4786
Moderator:HYDRA::SYSTEM
Created:Mon Jun 06 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3722
Total number of notes:11359

3255.0. "IBS Dr. Sommer - Point 21272" by KZIN::ASAP () Mon Mar 03 1997 10:06

    Company Name :  IBS Dr. Sommer - Point 21272
    Contact Name :  Andreas Sohn
    Phone        :  
    Fax          :  
    Email        :  [email protected]
    Date/Time in :   3-MAR-1997 15:05:27
    Entered by   :  Pauline Snyder
    SPE center   :  REO

    Category     :  unix
    OS Version   :  
    System H/W   :  


    Brief Description of Problem:
    -----------------------------

From:	KZIN::ASAP         "ASAP support" 28-FEB-1997 10:38:34.38
To:	watnow::pauline
CC:	ASAP
Subj:	FWD: 21272  IBS Dr. Sommer

From:	ESSB::ESSB::MRGATE::"ILO::ESSC::bsanting"   28-FEB-1997 10:30:59.30
To:	RDGENG::ASAP
CC:	
Subj:	21272  IBS Dr. Sommer

From:	NAME: ESCTECH@ILO          
	TEL: (822-)6704          
	ADDR: ILO                  <bsanting@ESSC@ILO>
To:	ASAP@RDGENG@MRGATE


Hello - 

POINT Log Number	 21272

Company Name 	IBS Dr. Sommer

Engineers name	Andreas Sohn

Telephone Number 		

Fax Number		

E-mail Address		[email protected]

Operating System, Version	Digital Unix

Platform			Alpha

Problem Statement		

Remote file locking in DEC UNIX (OSF1)
  
i have a problem with the file locking. If i lock a remote file (shellscript)
with our application an want to start the shellscript the performance is very
slow!
What can i do to lock (read lock) a file (remote/local) in UNIX and start the
shellscript which is on the file.



		   QED Qualitas Est Demonstrandum
		   ==============================
Ben Santing, Technical Consultant		Phone:  DTN 822 4330
European Customer Service Centre		Phone:  DTN 822 4269
Digital Equipment International B.V.		FAX:    DTN 822 4445

	     In replying, please use [email protected]



T.RTitleUserPersonal
Name
DateLines
3255.1more info reqdRDGENG::SNYDER_PThe speed of time is best set to 1sec/secFri Mar 14 1997 10:2450
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Digital ASAP call 21272 - IBS Dr. Sommer  
In-Reply-To: Your message of Fri, 28 Feb 97 10:38:33 +0000.
             <[email protected]> 
Date: Mon, 03 Mar 97 11:03:29 +0000
From: "Pauline Snyder" <pauline>
X-Mts: smtp

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From:  Pauline Snyder                      Loc: REO/F8    DTN: 830 4096
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
for the attention of Andreas Sohn

Andreas,

Thank you for your ASAP support call on Digital UNIX remote/local file 
locking.  Your call has been assigned to me so please e-mail me direct
while we investigate.

Can you give me a bit more information to help me find out what is
happening, please.

I presume you are using flock to lock the file with LOCK_SH.  Are you
also using LOCK_NB ?  Would this be appropriate ?  Just for interest
why are you locking the shellscript file ?

When you say 'the performance is very slow!' do you mean the 
performance of the locked script or the performance of the locking
application or the performance of the system in general ?  Can
you say how much slower, e.g. 1.1x , 10x, or 100x ?  Does this apply
when the application and script are on the same machine or only when
they are remote ?  Is the network connection tcp/ip ?

Any relevant code would be of interest.


Best regards,

Pauline

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pauline Snyder                    Software Partner Engineering, Reading
Digital Equipment Company Ltd.                   ASAP Technical Support
Digital Park,  Worton Grange                      
Imperial Way                                 email: [email protected]
Reading  RG2 0TE                             tel:      +44.118.920.4096
England                                      fax:      +44.118.920.4146
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=======================================================================
3255.2further info from customerRDGENG::SNYDER_PThe speed of time is best set to 1sec/secFri Mar 14 1997 10:25180
From: [email protected]
Received: from emout02.mail.aol.com (emout02.mx.aol.com [198.81.11.93]) by
server21.digital.fr (8.7.5/8.7) with ESMTP id IAA02888 for
<[email protected]>; Tue, 4 Mar 1997 08:28:52 +0100 (MET)
Received: (from root@localhost)
	  by emout02.mail.aol.com (8.7.6/8.7.3/AOL-2.0.0)
	  id CAA04774 for [email protected];
	  Tue, 4 Mar 1997 02:21:33 -0500 (EST)
Date: Tue, 4 Mar 1997 02:21:33 -0500 (EST)
Message-Id: <[email protected]>
To: [email protected]
Subject: Problem with remote file locking

Pauline,

Thanks for you email. Here are some details you want to know.

I am using the function fcntl with F_RDLCK.

The application that is lock the script file is an editor. The locking is
used so other editor session can find out that a file is in use.

The performance of the shellscript is very slow (factor 10 or greater). If i
edit a shellscript with the editor and start the shellscript then this 
script is very slow.
If i end the editor session the shell script is still very slow. If i copy
the shellscript it works ok. This is only if the shellscript is on a 
mounted filesystem.

I hope that i can help you to find out my problem with this informations.

With best regards

Andreas


Here is the code of the function which lock's the file:

/*===========================================================================*
/
/* lockFile-Routine                                              (c) by ibgs
*/
/*===========================================================================*
/
/* Autor    : A. Sohn
                                                       */
/* Datum    : 27.09.1995
                                                    */
/* Aufgabe  : lockFile erzeugt auf die uebergebene Datei ein Write-Lock.
    */
/*
                                                                          */
/*===========================================================================*
/
/*
                                                                          */
/* Rueckgabewert: Der uebergebene oder neu geoeffnete Datei desscriptor.
    */
/*
                                                                          */
/*===========================================================================*
/
/*
                                                                          */
/* Parameterbeschreibung:
                                                   */
/*
                                                                          */
/*  *cpFileName: ist der Dateiname einer Datei, die gelockt werden soll.
    */
/*
                                                                          */
/*  iFileDescriptor: ist der Datei descriptor einer Datei, die gelockt
werden*/
/*                   soll. Der Parameter iFileDescriptor wird nur benutzt,
  */
/*                   wenn kein Dateiname uebergeben wird !
                  */
/*
                                                                          */
/*===========================================================================*
/
/* Aenderungen Aenderungen Aenderungen Aenderungen Aenderungen Aenderungen
  */
/*===========================================================================*
/
/* Von  :
                                                                   */
/* Am   :
                                                                   */
/* Marke:
                                                                   */
/* Was  :
                                                                   */
/*
                                                                          */
/*===========================================================================*
/

/*---------------------------------------------------------------------------*
/
/* Notwendige include-Datei
                                                 */
/*---------------------------------------------------------------------------*
/
#include <ibgsFileMan.h>


/*---------------------------------------------------------------------------*
/
/* Funktionsanfang !!!
                                                      */
/*---------------------------------------------------------------------------*
/

int lockFile( char *cpFileName    ,
              int  iFileDescriptor  )
{
 int iFileId = -1;

#ifdef VMS
#else
 struct flock flLockStruct;
#endif


/*---------------------------------------------------------------------------*
/
 /* Der Datei-Descriptor der zu lockenden Datei wird bestimmt.
               */

/*---------------------------------------------------------------------------*
/

 if ( cpFileName  && strlen( cpFileName ) )
    iFileId = open( convertUNIXtoOther( cpFileName, 0 ), O_RDWR );
 else if ( iFileDescriptor > -1 )
    iFileId = iFileDescriptor;
 else
    iFileId = -1;



/*---------------------------------------------------------------------------*
/
 /* Die Datei wird gelockt.
                                                  */

/*---------------------------------------------------------------------------*
/

 if ( iFileId > -1 )
    {
#ifdef VMS
#else
    lseek( iFileId, 0L, 0 );

    flLockStruct.l_type   = F_RDLCK;
    flLockStruct.l_whence = 0;
    flLockStruct.l_start  = 0;
    flLockStruct.l_len    = 0;

    if ( fcntl( iFileId, F_SETLK, &flLockStruct ) == -1 )
       iFileId = -1;


#endif
    }


/*---------------------------------------------------------------------------*
/
 /* Der Datei-Descriptor der gelockten Datei wird zurueck geliefert.
         */

/*---------------------------------------------------------------------------*
/

 return iFileId;
}
3255.3that's the way it is....RDGENG::SNYDER_PThe speed of time is best set to 1sec/secFri Mar 14 1997 10:2652
To: [email protected]
Cc: [email protected]
Subject: Re: Problem with remote file locking  
In-Reply-To: Your message of Tue, 04 Mar 97 02:21:33 -0500.
             <[email protected]> 
Date: Tue, 04 Mar 97 09:32:49 +0000
From: "Pauline Snyder" <pauline>
X-Mts: smtp

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From:  Pauline Snyder                      Loc: REO/F8    DTN: 830 4096
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
for the attention of Andreas Sohn

Andreas,

This extract from the man page for fcntl relating to client data 
cacheing is the probable explanation for the slower operation.  The
[Digital] prefix means this is a Digital implementation specific note
in the man page.

  [Digital]  In order to maintain consistency in the network case, data must
  not be cached on client machines. For this reason, file buffering for an
  NFS file is turned off when the first lock is attempted on the file.
  Buffering remains off as long as the file is open. Programs that do I/O
  buffering in the user address space, however, may have inconsistent
  results. The standard I/O package, for instance, is a common source of
  unexpected buffering.

Turning off file buffering would certainly cause a significant slow down 
which would continue until the script was exited even though the edit 
session was terminated and is consistent with your other observations.

As a general principle Digital UNIX will tend towards caution where other
implementations may merely document that file consistency may not be
maintained across a network.  What other UNIX implementations of your
software do you have and how do they compare in this respect ?


Best regards,

Pauline

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pauline Snyder                    Software Partner Engineering, Reading
Digital Equipment Company Ltd.    
Digital Park,  Worton Grange                      
Imperial Way                                 email: [email protected]
Reading  RG2 0TE                             tel:      +44.118.920.4096
England                                      fax:      +44.118.920.4146
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=======================================================================
3255.4How can i change this ... ?RDGENG::SNYDER_PThe speed of time is best set to 1sec/secFri Mar 14 1997 10:2723
From: [email protected]
Received: from emout08.mail.aol.com (emout08.mx.aol.com [198.81.11.23]) by
server21.digital.fr (8.7.5/8.7) with ESMTP id OAA07738 for
<[email protected]>; Fri, 7 Mar 1997 14:07:28 +0100 (MET)
Received: (from root@localhost)
	  by emout08.mail.aol.com (8.7.6/8.7.3/AOL-2.0.0)
	  id IAA29937 for [email protected];
	  Fri, 7 Mar 1997 08:00:06 -0500 (EST)
Date: Fri, 7 Mar 1997 08:00:06 -0500 (EST)
Message-Id: <[email protected]>
To: [email protected]
Subject: How can i change this ...

Pauline,

thanks for your answer, but how can i change the file status when i end the
edit
session. In other word how must i change our locking mechanism so that this
error does not occur.

Best regards

Andreas