[RFC] Use mutexes by default in db_open()

Jeremy Allison jra at samba.org
Sat May 6 21:15:27 UTC 2017


On Mon, Apr 24, 2017 at 04:16:45PM +0200, Ralph Böhme via samba-technical wrote:
> Hi!
> 
> Is there any reason not to use mutexes by default? Maybe for 4.7?

Ping. Can you propose this as an official patch ?

> From 9aff7e4bc481e7b7517cb97149a841de45e68d90 Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <slow at samba.org>
> Date: Mon, 24 Apr 2017 16:10:23 +0200
> Subject: [PATCH] s3/dbwrap: enable mutexes by default
> 
> For small file copy workloads this makes a huge difference in the number
> of fcntl() syscalls.
> 
> Eg copying 10,000 files, without mutexes:
> 
> % time     seconds  usecs/call     calls    errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> ...
>  32.16    3.149828           6    498574           fcntl
> ...
> 
> Enabling mutexes by setting "dbwrap_tdb_mutexes:* = yes":
> 
> % time     seconds  usecs/call     calls    errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> ...
>   7.37    0.577316           7     81998           fcntl
> ...
> 
> So 500k vs 80k.
> 
> Signed-off-by: Ralph Boehme <slow at samba.org>
> ---
>  source3/lib/dbwrap/dbwrap_open.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
> index feb9f5e..5e9a7b0 100644
> --- a/source3/lib/dbwrap/dbwrap_open.c
> +++ b/source3/lib/dbwrap/dbwrap_open.c
> @@ -97,7 +97,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
>  
>  	if (tdb_flags & TDB_CLEAR_IF_FIRST) {
>  		const char *base;
> -		bool try_mutex = false;
> +		bool try_mutex = true;
>  		bool require_mutex = false;
>  
>  		base = strrchr_m(name, '/');
> -- 
> 2.9.3
> 




More information about the samba-technical mailing list