Thread

  1. RE: Troubles with performances

    Mikheev, Vadim <vmikheev@sectorbase.com> — 2001-01-18T18:56:38Z

    > >> I use PostGreSQL with a Web server which receive 200 HTTP 
    > >> simultaneous queries.
    > > 
    > > With what opts do you start postmaster?
    > -F to disable fsync()
    > I don't know if I have to use the -B and -S options to change 
    > the memory use...
    
    With 200 simult connections I would recomment to use
    -N 256 -B 16384
    
    Vadim
    
    
  2. RE: Troubles with performances

    Warren Vanichuk <pyber@street-light.com> — 2001-01-18T20:04:44Z

    > > >> I use PostGreSQL with a Web server which receive 200 HTTP 
    > > >> simultaneous queries.
    > > > 
    > > > With what opts do you start postmaster?
    > > -F to disable fsync()
    > > I don't know if I have to use the -B and -S options to change 
    > > the memory use...
    > 
    > With 200 simult connections I would recomment to use
    > -N 256 -B 16384
    
    As we are about the same load, and I am always interested in more
    performance, I increased the value of my -B to what you suggested, but I
    generate the following error :
    
    IpcMemoryCreate: shmget failed (Invalid argument) key=5432001, size=143193088, permission=600
    This type of error is usually caused by an improper
    shared memory or System V IPC semaphore configuration.
    For more information, see the FAQ and platform-specific
    FAQ's in the source directory pgsql/doc or on our
    web site at http://www.postgresql.org.
    FATAL 1:  ShmemCreate: cannot create region
    
    I checked the Linux FAQ and the only thing related to this issue says that I
    don't have shared memory turned on, which I'm pretty sure I do, considering
    it's running..  ;)
    
    This is a PostgreSQL 7.0.3 installed on a Debian (Stable) box, running Linux
    2.2.18.  The machine has 1GB of memory, and is compiled for 32,768 file
    descriptors.  The startup options I am using for PostgreSQL are :
    
    -o -F -B 2048 -N 512 -S 4096
    
    Opinions or suggestions? :)
    
    Sincerely, Warren
    
    
    
  3. Re: Troubles with performances

    Lamar Owen <lamar.owen@wgcr.org> — 2001-01-18T21:06:15Z

    Warren Vanichuk wrote:
    > IpcMemoryCreate: shmget failed (Invalid argument) key=5432001, size=143193088, permission=600
    
    > -o -F -B 2048 -N 512 -S 4096
    
    Ok, you have 2048 8K buffers, and up to 512 backends.  If you're trying
    to set SortSize to 4096, you need quotes around it and a -o, AFAIK, asx
    the -S postmaster option sets silent mode.
    
    Further along,
    
    According to the shmget man page:
    
           The  followings  are  limits  on  shared  memory   segment
           resources affecting a shmget call:
    
           SHMALL     System  wide  maximum  of  shared memory pages:
                      policy dependent.
    
           SHMMAX     Maximum size in bytes for a shared memory  seg­
                      ment:  implementation dependent (currently 4M).
    
           SHMMIN     Minimum size in bytes for a shared memory  seg­
                      ment:  implementation  dependent  (currently  1
                      byte, though PAGE_SIZE is the effective minimum
                      size).
    
           SHMMNI     System  wide  maximum  number  of shared memory
                      segments: implementation  dependent  (currently
                      4096).
    
           The implementation has no specific limits for the per pro­
           cess maximum number of shared memory segments (SHMSEG).
    
    And from the linux kernel source, includes/asm-i386/shmparam.h:
    /*
     * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and
     * there is a static array of size SHMMNI.
     */
    #define _SHM_ID_BITS    9
    #define SHM_ID_MASK     ((1<<_SHM_ID_BITS)-1)
    
    #define SHM_IDX_SHIFT   (_SHM_ID_BITS)
    #define _SHM_IDX_BITS   15
    #define SHM_IDX_MASK    ((1<<_SHM_IDX_BITS)-1)
    
    /*
     * _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and
     * SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS).
     */
    
    #define SHMMAX 0x2000000                /* max shared seg size (bytes)
    */
    /* Try not to change the default shipped SHMMAX - people rely on it */
    
    -------
    
    Hmmmm....
    
    Looks pretty difficult to change.
    --
    Lamar Owen
    WGCR Internet Radio
    1 Peter 4:11
    
    
  4. Re: Troubles with performances

    Jan Wieck <janwieck@yahoo.com> — 2001-01-19T13:03:02Z

    Lamar Owen wrote:
    >
    > /*
    >  * _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and
    >  * SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS).
    >  */
    >
    > #define SHMMAX 0x2000000                /* max shared seg size (bytes)
    > */
    > /* Try not to change the default shipped SHMMAX - people rely on it */
    >
    > -------
    >
    > Hmmmm....
    >
    > Looks pretty difficult to change.
    
        echo 134217728 >/proc/sys/kernel/shmmax
    
        set's  the  maximum  allowed  segment!  size  to 128M. Shared
        memory under Linux can  be  swapped,  so  if  you  have  256M
        physical  and  run  3  postmasters, you can start all of them
        with 64M (or more) and while they're  idle  they  most  likey
        consume  some swap space. But when it poors, they'll grab the
        memory they need.
    
    
    Jan
    
    --
    
    #======================================================================#
    # It's easier to get forgiveness for being wrong than for being right. #
    # Let's break this rule - forgive me.                                  #
    #================================================== JanWieck@Yahoo.com #
    
    
    
    _________________________________________________________
    Do You Yahoo!?
    Get your free @yahoo.com address at http://mail.yahoo.com
    
    
    
  5. Re: Troubles with performances

    Lamar Owen <lamar.owen@wgcr.org> — 2001-01-19T19:41:50Z

    Jan Wieck wrote:
    > Lamar Owen wrote:
    > > Looks pretty difficult to change.
     
    >     echo 134217728 >/proc/sys/kernel/shmmax
     
    >     set's  the  maximum  allowed  segment!  size  to 128M. Shared
    >     memory under Linux can  be  swapped,  so  if  you  have  256M
    
    One of those well-documented /proc deals.
    
    Might have guessed. :-) Everything else seems to work that way.... :-)
    --
    Lamar Owen
    WGCR Internet Radio
    1 Peter 4:11
    
    
  6. Re: Troubles with performances

    Martijn van Oosterhout <kleptog@cupid.suninternet.com> — 2001-01-19T21:26:32Z

    Lamar Owen wrote:
    > 
    > Warren Vanichuk wrote:
    > > IpcMemoryCreate: shmget failed (Invalid argument) key=5432001, size=143193088, permission=600
    > 
    > > -o -F -B 2048 -N 512 -S 4096
    > 
    > Ok, you have 2048 8K buffers, and up to 512 backends.  If you're trying
    > to set SortSize to 4096, you need quotes around it and a -o, AFAIK, asx
    > the -S postmaster option sets silent mode.
    > 
    > Further along,
    > 
    > According to the shmget man page:
    > 
    [snip]
    
    I think these are the ones you're looking for:
    
    kleptog/~>grep . `find /proc/sys -name '*shm*'`
    /proc/sys/kernel/shmall:4194304
    /proc/sys/kernel/shmmax:33554432
    
    Just echo new values into there to change them...
    -- 
    Martijn van Oosterhout <kleptog@cupid.suninternet.com>
    http://cupid.suninternet.com/~kleptog/