Bug 125056 - Unnecessary msync() call kills databases/rrdtool performance under FreeBSD
Summary: Unnecessary msync() call kills databases/rrdtool performance under FreeBSD
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Rong-En Fan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-27 22:00 UTC by Marcus Reid
Modified: 2008-06-30 07:00 UTC (History)
0 users

See Also:


Attachments
file.diff (495 bytes, patch)
2008-06-27 22:00 UTC, Marcus Reid
no flags Details | Diff
patch-src__rrd_open.c (483 bytes, application/octet-stream)
2008-06-30 04:58 UTC, RenZhen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Reid 2008-06-27 22:00:09 UTC
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.)

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:
How-To-Repeat: Do back-to-back updates using some fast rrdtool language bindings and
watch as it goes really slow.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-06-30 00:18:04 UTC
Maintainer of databases/rrdtool,

Please note that PR ports/125056 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/125056

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2008-06-30 00:18:05 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 RenZhen 2008-06-30 04:58:40 UTC
The patch has been approved. The msync is unnecessary for FreeBSD. But
the madvise is useful for big files? Please place the
patch-src__rrd_open.c to the rrdtool/files directory.

On Mon, Jun 30, 2008 at 2:18 PM, Edwin Groothuis <edwin@freebsd.org> wrote:
> Maintainer of databases/rrdtool,
>
> Please note that PR ports/125056 has just been submitted.
>
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
>
> The full text of the PR can be found at:
>    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/125056
>
> --
> Edwin Groothuis via the GNATS Auto Assign Tool
> edwin@FreeBSD.org
>
Comment 4 Rong-En Fan freebsd_committer freebsd_triage 2008-06-30 05:49:25 UTC
Responsible Changed
From-To: freebsd-ports-bugs->rafan

I will take it.
Comment 5 Rong-En Fan freebsd_committer freebsd_triage 2008-06-30 06:52:05 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!
Comment 6 dfilter service freebsd_committer freebsd_triage 2008-06-30 06:52:30 UTC
rafan       2008-06-30 05:52:25 UTC

  FreeBSD ports repository

  Modified files:
    databases/rrdtool    Makefile 
  Added files:
    databases/rrdtool/files patch-src-rrd_open.c 
  Log:
  - Remove unnecessary msync() which impact performance a lot
  - Bump PORTREVISION
  
  PR:             ports/125056
  Submitted by:   Marcus Reid <marcus at blazingdot.com>
  Approved by:    maintainer
  
  Revision  Changes    Path
  1.77      +1 -0      ports/databases/rrdtool/Makefile
  1.1       +12 -0     ports/databases/rrdtool/files/patch-src-rrd_open.c (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"