Statistics on number of oplocks taken out on a Samba server

Richard Sharpe sharpe at
Thu Jan 3 21:57:02 GMT 2002

Jim Morris wrote:

> Richard Sharpe wrote:
>> Does anyone have any statistics on the max and average number of 
>> oplocks taken out by Windows clients against a Samba server?
>> Is it like 1/20 per client, 2/20, 0.5/10? Any gut feels at all?
> On several small to medium sized LAN's (up to 50 active Windows 
> clients), I have often taken a "snapshot" of the lock status of Samba 
> using smbstatus.  I normally see no more than 10 to 20 active oplocks 
> shown by smbstatus at any single point in time, even on the 50 user 
> network. 

Hmmm, that is useful info. My question was in the context of a kernel 
implementation (under FreeBSD) of OpLocks. The code base I am working 
with keeps oplocks in a singly linked list (SLIST_*...). This list will 
have to be searched for every file open to look for oplocks. If a server 
is supporting 1,000 clients, or even 10,000 clients :-), that could be a 
lot of oplocks, and thus a long list to search :-(

More anecdotes required.

> My observations are that the use of oplocks is VERY application 
> dependent.  Some proprietary database applications I have worked on 
> code for can open as many as 100 dBASE files on a Samba share.  
> Depending on Samba and client settings, that could be as many as 100 
> outstanding oplocks.  Get several users running that application 
> (written in Borland C++ Builder), and you can see a LOT of oplock and 
> oplock break related log messages in the Samba log files, depending on 
> the log level. Contrast that to a user running Word editing a 
> document, who will only have a lock on the document(s) being edited.  
> A user just connected to a share or browsing it with Windows Explorer 
> will not have any outstanding oplocks.
> That said - in all LAN environments I work with, only data files are 
> stored on the Samba server - applications are typically installed 
> locally on the client systems. So you typically will only see one 
> oplock per open file.  If the apps were running from a network drive, 
> I am sure oplock use would be significantly higher.
> I don't know if my highly NON-empirical data is any help, but there it 
> is! ;-)
> Jim Morris (Jim at

Richard Sharpe, rsharpe at, LPIC-1,, SAMS Teach Yourself Samba 
in 24 Hours, Special Edition, Using Samba

More information about the samba-technical mailing list