Home Explore Blog CI



postgresql

36th chunk of `doc/src/sgml/config.sgml`
200e62eeb99c36d75c8c9479955e6412653e7507625a6f490000000100000fa0
       (Linux, FreeBSD) or <function>copyfile</function>
        (macOS) system calls, giving the kernel the opportunity to share disk
        blocks or push work down to lower layers on some file systems.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-max-notify-queue-pages" xreflabel="max_notify_queue_pages">
      <term><varname>max_notify_queue_pages</varname> (<type>integer</type>)
      <indexterm>
       <primary><varname>max_notify_queue_pages</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Specifies the maximum amount of allocated pages for
        <xref linkend="sql-notify"/> / <xref linkend="sql-listen"/> queue.
        The default value is 1048576. For 8 KB pages it allows to consume
        up to 8 GB of disk space.
       </para>
      </listitem>
     </varlistentry>

     </variablelist>
     </sect2>

     <sect2 id="runtime-config-resource-kernel">
     <title>Kernel Resource Usage</title>

     <variablelist>
     <varlistentry id="guc-max-files-per-process" xreflabel="max_files_per_process">
      <term><varname>max_files_per_process</varname> (<type>integer</type>)
      <indexterm>
       <primary><varname>max_files_per_process</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Sets the maximum number of open files each server subprocess is
        allowed to open simultaneously;  files already opened in the
        postmaster are not counted toward this limit. The default is one
        thousand files.
       </para>
       <para>
        If the kernel is enforcing
        a safe per-process limit, you don't need to worry about this setting.
        But on some platforms (notably, most BSD systems), the kernel will
        allow individual processes to open many more files than the system
        can actually support if many processes all try to open
        that many files. If you find yourself seeing <quote>Too many open
        files</quote> failures, try reducing this setting.
        This parameter can only be set at server start.
       </para>
      </listitem>
     </varlistentry>
     </variablelist>
    </sect2>


    <sect2 id="runtime-config-resource-background-writer">
     <title>Background Writer</title>

     <para>
      There is a separate server
      process called the <firstterm>background writer</firstterm>, whose function
      is to issue writes of <quote>dirty</quote> (new or modified) shared
      buffers.  When the number of clean shared buffers appears to be
      insufficient, the background writer writes some dirty buffers to the
      file system and marks them as clean.  This reduces the likelihood
      that server processes handling user queries will be unable to find
      clean buffers and have to write dirty buffers themselves.
      However, the background writer does cause a net overall
      increase in I/O load, because while a repeatedly-dirtied page might
      otherwise be written only once per checkpoint interval, the
      background writer might write it several times as it is dirtied
      in the same interval.  The parameters discussed in this subsection
      can be used to tune the behavior for local needs.
     </para>

     <variablelist>
      <varlistentry id="guc-bgwriter-delay" xreflabel="bgwriter_delay">
       <term><varname>bgwriter_delay</varname> (<type>integer</type>)
       <indexterm>
        <primary><varname>bgwriter_delay</varname> configuration parameter</primary>
       </indexterm>
       </term>
       <listitem>
        <para>
         Specifies the delay between activity rounds for the
         background writer.  In each round the writer issues writes
         for some number of dirty buffers (controllable by the
         following parameters).  It then sleeps for
         the length of <varname>bgwriter_delay</varname>, and repeats.
         When there are no dirty

Title: Configuration Parameters: Kernel Resource Usage (max_files_per_process) and Background Writer (bgwriter_delay)
Summary
This section covers kernel resource limits and background writer configuration. `max_files_per_process` sets the maximum number of open files each server subprocess can have, defaulting to 1000. Reducing this setting can help avoid 'Too many open files' errors on some systems. This parameter can only be set at server start. The background writer process writes dirty shared buffers. `bgwriter_delay` specifies the delay between the background writer's activity rounds, where it writes dirty buffers before sleeping. The background writer aims to maintain sufficient clean shared buffers, reducing the likelihood of server processes needing to write dirty buffers themselves.