Bacula-users

[Bacula-users] Support for HAVE_POSIX_FADVISE on Bacula Client

2015-10-07 05:40:40
Subject: [Bacula-users] Support for HAVE_POSIX_FADVISE on Bacula Client
From: Robert Heinzmann <r.heinzmann AT freelancer.traviangames DOT com>
To: "bacula-users AT lists.sourceforge DOT net" <bacula-users AT lists.sourceforge DOT net>
Date: Wed, 7 Oct 2015 09:16:15 +0000

Hello,

 

we are using bacula on a virtual plattform (> 600 clients) and investiate moderate swap usage issues / cache usage issues. It seems that during backup of mysql datafiles (LVM Snapshot), the “cached” memory usage of the server increases and thus bacula backup reads (only done one) are cached (… polluting the rest of the vfs cache ?)

 

From reading the source of src/findlib/bfile.c, bacula supports posix_fadvise for a long time now (2007), by those two code pices:

 

commit 4df486dd5b04cc16178efcb75eaf3dbd4be44b31

Author: Kern Sibbald <kern AT sibbald DOT com>

Date:   Thu May 24 19:58:07 2007 +0000

 

    kes  Add code to tell the OS that we no longer need a cached

         file that we were reading. In findlib/bfile.c.  Also,

         only cache files that we are reading.

    kes  Tweak to bsmtp to eliminate compiler warnings on Win32.

    kes  Implement script to automatically generate cats and dll .def

         files for Win32 dll.

    kes  Update README.mingw32 to include new .def file generation.

 

    git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4898 91ce42f0-d328-0410-95d8-f526ca767f89

 

bopen()

 

#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)

   if (bfd->fid != -1 && flags & O_RDONLY) {

      int stat = posix_fadvise(bfd->fid, 0, 0, POSIX_FADV_WILLNEED);

      Dmsg2(400, "Did posix_fadvise on %s stat=%d\n", fname, stat);

   }

#endif

 

bclose()

 

#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)

   if (bfd->m_flags & O_RDONLY) {

      fdatasync(bfd->fid);            /* sync the file */

      /* Tell OS we don't need it any more */

      posix_fadvise(bfd->fid, 0, 0, POSIX_FADV_DONTNEED);

   }

#endif

 

I checked that our bacula client was compiled with HAVE_POSIX_FADVISE (added debug messages).

 

I also added more debugging code and it seems that during a normal backup run, the code is never executed on bacula-fd as O_RDONLY is not set in the flags of the originating bopen request.

 

Is this a bug or a feature ?

 

How can I prevent cache usage of bacula-fd on the client side at all ? Is there a Flag in bacula-fd to force O_READONLY opening of backed up files ?

 

Regards,

Robert

------------------------------------------------------------------------------
Full-scale, agent-less Infrastructure Monitoring from a single dashboard
Integrate with 40+ ManageEngine ITSM Solutions for complete visibility
Physical-Virtual-Cloud Infrastructure monitoring from one console
Real user monitoring with APM Insights and performance trend reports 
Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911&iu=/4140
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users