HP OpenVMS Systems

ask the wizard
Content starts here

fflush slows performance? (rundown)

» close window

The Question is:

 
Dear Sir, Madam,
 
I am busy tracking a performance problem in one of the application (written
in "C").
This application is logging a lot of messages that might be used in future
should the system crashes.
We noticed that each write is followed by a fflush().
If we removed the fflush the system performance increases by more than 500
%.
The questions are: When is the flushing necessary ? Does VMS have  its own
automatic flushing facility ( a periodic flushig that occures after a
configured period of time, or when a process crashes, or when the UPS
detects a loss of power ) ? Does VMS flu
sh automatically the cache once we've reached the buffer capacity.
 
Thanks and regards
 
Philippe Delcroix
 


The Answer is :

 
  What you are seeing results from explicitly flushing the contents of
  the I/O cache to disk, and -- implicitly -- an indication of the
  performance benefits of using I/O caches.
 
  OpenVMS does flush the contents of I/O buffers as the buffers fill
  or as the application closes the file or as the application image
  or process goes through an operation known as "rundown".
 
  OpenVMS includes an operation known as a process rundown, and this
  operation is performed during a typical image exit.  The process
  rundown flushes the contents of the process I/O caches to disk.
  Contrast this with the behaviour on process deletion (sys$delprc
  call, STOP/ID command, etc) or system crash, when no rundown is
  performed.
 
  Better control over file writes than is possible in native C can be
  achieved by replacing C calls with direct calls to the RMS services.
 
  Alternatives include writing the log to another (logging) process on
  the local node, or to an application running on another node.
 
  OpenVMS does not have a mechanism which ties it to a UPS.  That said,
  it is generally quite trivial to connect OpenVMS to the UPS to handle
  a UPS-requested shutdown via communications over a serial line or via
  modem control signals.  The application shutdown can be handled via
  commands added into the SYSHUTDWN.COM command procedure.
 
  The OpenVMS Wizard would recommend a visit to the Guide to OpenVMS
  File Applications and the OpenVMS Record Management Services Reference
  Manual.  Both are included in the OpenVMS documentation set.

answer written or last revised on ( 14-APR-1999 )

» close window