ports/125056: Unnecessary msync() call kills rrdtool performance under FreeBSD

Marcus Reid marcus at blazingdot.com
Fri Jun 27 21:00:10 UTC 2008


>Number:         125056
>Category:       ports
>Synopsis:       Unnecessary msync() call kills rrdtool performance under FreeBSD
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 27 21:00:09 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Marcus Reid
>Release:        7.0-STABLE
>Organization:
>Environment:
FreeBSD socbox.megapath.biz 7.0-STABLE FreeBSD 7.0-STABLE #0: Tue Jun 17 07:02:32 UTC 2008     toor at socbox.megapath.biz:/usr/obj/usr/src/sys/FARK  i386
>Description:
Version 1.3.0 of rrdtool calls msync() for each update, which is necessary under Linux but severely impacts update performance under FreeBSD.  Due to differences in the buffer caches of the different platforms, msync() is obsolete under FreeBSD but necessary under Linux (see the man page for each platform.)
>How-To-Repeat:
Do back-to-back updates using some fast rrdtool language bindings and watch as it goes really slow.
>Fix:
*** src/rrd_open.c.orig Fri Jun 27 20:55:00 2008
--- src/rrd_open.c      Fri Jun 27 20:55:20 2008
***************
*** 388,396 ****
      int       ret;
  
  #ifdef HAVE_MMAP
-     ret = msync(rrd_file->file_start, rrd_file->file_len, MS_ASYNC);
-     if (ret != 0)
-         rrd_set_error("msync rrd_file: %s", rrd_strerror(errno));
      ret = munmap(rrd_file->file_start, rrd_file->file_len);
      if (ret != 0)
          rrd_set_error("munmap rrd_file: %s", rrd_strerror(errno));
--- 388,393 ----

Patch attached with submission follows:

*** src/rrd_open.c.orig	Fri Jun 27 20:55:00 2008
--- src/rrd_open.c	Fri Jun 27 20:55:20 2008
***************
*** 388,396 ****
      int       ret;
  
  #ifdef HAVE_MMAP
-     ret = msync(rrd_file->file_start, rrd_file->file_len, MS_ASYNC);
-     if (ret != 0)
-         rrd_set_error("msync rrd_file: %s", rrd_strerror(errno));
      ret = munmap(rrd_file->file_start, rrd_file->file_len);
      if (ret != 0)
          rrd_set_error("munmap rrd_file: %s", rrd_strerror(errno));
--- 388,393 ----


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list