Thread: postgresql and smp linux kernel

postgresql and smp linux kernel

From
zhicheng wang
Date:

Dear all

i have a dedicated server mainly running postgresql,
currently rh-posgtresql-7.3.6.7 (and samba, ypbind
etc). The server is a dual processor machine and the
OS is RHEL AS 3.

I am currently running kernel-smp-2.4.21-15.0.4.EL.

My question is: do i need to run smp kernel for
postgresql? What is benefit of it? If I run UP kernel,
what do I lose from the point view of PG?

Thanks


=====
Best wishes
Z C Wang





___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com 

Re: postgresql and smp linux kernel

From
Oliver Elphick
Date:
On Mon, 2004-08-09 at 11:10, zhicheng wang wrote:
> Dear all
>
> i have a dedicated server mainly running postgresql,
> currently rh-posgtresql-7.3.6.7 (and samba, ypbind
> etc). The server is a dual processor machine and the
> OS is RHEL AS 3.
>
> I am currently running kernel-smp-2.4.21-15.0.4.EL.
>
> My question is: do i need to run smp kernel for
> postgresql? What is benefit of it? If I run UP kernel,
> what do I lose from the point view of PG?

You do not NEED it for Pg, but it will improve performance.  Each
separate session gets a different process and therefore has a change to
run on the second processor concurrently with another session on the
first processor.  The same goes for any other processes that are
running, of course.

If you do not use an SMP kernel, one of your processors will sit there
for ever doing nothing, which is money down the drain.

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "Be still before the LORD and wait patiently for him;
      do not fret when men succeed in their ways, when they
      carry out their wicked schemes."
                            Psalms 37:7


Re: postgresql and smp linux kernel

From
zhicheng wang
Date:
Thanks Oliver Elphick
does this mean that the applications do not need to be
multi-threading in order to use multi-processors?

cheng


 --- Oliver Elphick <olly@lfix.co.uk> wrote:
> On Mon, 2004-08-09 at 11:10, zhicheng wang wrote:
> > Dear all
> >
> > i have a dedicated server mainly running
> postgresql,
> > currently rh-posgtresql-7.3.6.7 (and samba, ypbind
> > etc). The server is a dual processor machine and
> the
> > OS is RHEL AS 3.
> >
> > I am currently running
> kernel-smp-2.4.21-15.0.4.EL.
> >
> > My question is: do i need to run smp kernel for
> > postgresql? What is benefit of it? If I run UP
> kernel,
> > what do I lose from the point view of PG?
>
> You do not NEED it for Pg, but it will improve
> performance.  Each
> separate session gets a different process and
> therefore has a change to
> run on the second processor concurrently with
> another session on the
> first processor.  The same goes for any other
> processes that are
> running, of course.
>
> If you do not use an SMP kernel, one of your
> processors will sit there
> for ever doing nothing, which is money down the
> drain.
>
> --
> Oliver Elphick
>    olly@lfix.co.uk
> Isle of Wight
> http://www.lfix.co.uk/oliver
> GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0
> 5664 7A2F A543 10EA
>
> ========================================
>      "Be still before the LORD and wait patiently
> for him;
>       do not fret when men succeed in their ways,
> when they
>       carry out their wicked schemes."
>                             Psalms 37:7
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
>

=====
Best wishes
Z C Wang





___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com 

Re: postgresql and smp linux kernel

From
Bill Moran
Date:
zhicheng wang <wang_zc@yahoo.co.uk> wrote:

> Thanks Oliver Elphick
> does this mean that the applications do not need to be
> multi-threading in order to use multi-processors?

Yes, that's what it means.  Although you've probably oversimplified it
too much.  Multi-process applications make use of multiple processors
just as well as multi-threaded apps do.

>  --- Oliver Elphick <olly@lfix.co.uk> wrote:
> > On Mon, 2004-08-09 at 11:10, zhicheng wang wrote:
> > > Dear all
> > >
> > > i have a dedicated server mainly running
> > postgresql,
> > > currently rh-posgtresql-7.3.6.7 (and samba, ypbind
> > > etc). The server is a dual processor machine and
> > the
> > > OS is RHEL AS 3.
> > >
> > > I am currently running
> > kernel-smp-2.4.21-15.0.4.EL.
> > >
> > > My question is: do i need to run smp kernel for
> > > postgresql? What is benefit of it? If I run UP
> > kernel,
> > > what do I lose from the point view of PG?
> >
> > You do not NEED it for Pg, but it will improve
> > performance.  Each
> > separate session gets a different process and
> > therefore has a change to
> > run on the second processor concurrently with
> > another session on the
> > first processor.  The same goes for any other
> > processes that are
> > running, of course.
> >
> > If you do not use an SMP kernel, one of your
> > processors will sit there
> > for ever doing nothing, which is money down the
> > drain.
> >
> > --
> > Oliver Elphick
> >    olly@lfix.co.uk
> > Isle of Wight
> > http://www.lfix.co.uk/oliver
> > GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0
> > 5664 7A2F A543 10EA
> >
> > ========================================
> >      "Be still before the LORD and wait patiently
> > for him;
> >       do not fret when men succeed in their ways,
> > when they
> >       carry out their wicked schemes."
> >                             Psalms 37:7
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> >
> > http://www.postgresql.org/docs/faqs/FAQ.html
> >
> >
>
> =====
> Best wishes
> Z C Wang
>
>
>
>
>
> ___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more
fun! http://uk.messenger.yahoo.com 
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


--
Bill Moran
Potential Technologies
http://www.potentialtech.com

Re: postgresql and smp linux kernel

From
"Scott Marlowe"
Date:
On Mon, 2004-08-09 at 04:10, zhicheng wang wrote:
> Dear all
>
> i have a dedicated server mainly running postgresql,
> currently rh-posgtresql-7.3.6.7 (and samba, ypbind
> etc). The server is a dual processor machine and the
> OS is RHEL AS 3.
>
> I am currently running kernel-smp-2.4.21-15.0.4.EL.
>
> My question is: do i need to run smp kernel for
> postgresql? What is benefit of it? If I run UP kernel,
> what do I lose from the point view of PG?

Let's be clear here, PostgreSQL isn't responsible for exploiting your
second CPU, the OS is.  The face that PostgreSQL spawns a new backend
process for each connection means that it can use about as many
processors as it has connections, plus maybe one for the OS.

However, the OS will not schedule anything to run at all on the second
CPU if you run a UP kernel.

Generally, the linux and bsd kernels both tend to get a scaling factor
of near unity for the second CPU with enough things to do in parallel.
There's almost no loss for single processes hogging one CPU, and even
these tasks are often sped up by the OS having a CPU to run on while
your one big process is hogging the other one.

Considering you're running samba, which is also process based, it would
be wise to enable the second CPU in the kernel, otherwise pull it, put
in the terminator, and save it in case of future CPU failure.  It won't
be doing you any good.


Re: postgresql and smp linux kernel

From
zhicheng wang
Date:
Thanks for the clear answer.

What about hyper-threading? At the moment, I have
hyper-threading enabled and the OS sees four CPUs (two
physical and two virtual). Do these two virtual ones
really work as the real ones?

I am asking these because we use SAN disks and the
secure-path (a fail safe mechanism) only support UP
kernel. I have to choose do we run smp or do we make
use of secure-path.

Regards
cheng



 --- Bill Moran <wmoran@potentialtech.com> wrote:
> zhicheng wang <wang_zc@yahoo.co.uk> wrote:
>
> > Thanks Oliver Elphick
> > does this mean that the applications do not need
> to be
> > multi-threading in order to use multi-processors?
>
> Yes, that's what it means.  Although you've probably
> oversimplified it
> too much.  Multi-process applications make use of
> multiple processors
> just as well as multi-threaded apps do.
>
> >  --- Oliver Elphick <olly@lfix.co.uk> wrote:
> > > On Mon, 2004-08-09 at 11:10, zhicheng wang
> wrote:
> > > > Dear all
> > > >
> > > > i have a dedicated server mainly running
> > > postgresql,
> > > > currently rh-posgtresql-7.3.6.7 (and samba,
> ypbind
> > > > etc). The server is a dual processor machine
> and
> > > the
> > > > OS is RHEL AS 3.
> > > >
> > > > I am currently running
> > > kernel-smp-2.4.21-15.0.4.EL.
> > > >
> > > > My question is: do i need to run smp kernel
> for
> > > > postgresql? What is benefit of it? If I run UP
> > > kernel,
> > > > what do I lose from the point view of PG?
> > >
> > > You do not NEED it for Pg, but it will improve
> > > performance.  Each
> > > separate session gets a different process and
> > > therefore has a change to
> > > run on the second processor concurrently with
> > > another session on the
> > > first processor.  The same goes for any other
> > > processes that are
> > > running, of course.
> > >
> > > If you do not use an SMP kernel, one of your
> > > processors will sit there
> > > for ever doing nothing, which is money down the
> > > drain.
> > >
> > > --
> > > Oliver Elphick
>
> > >    olly@lfix.co.uk
> > > Isle of Wight
> > > http://www.lfix.co.uk/oliver
> > > GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E
> 1EC0
> > > 5664 7A2F A543 10EA
> > >
> > > ========================================
> > >      "Be still before the LORD and wait
> patiently
> > > for him;
> > >       do not fret when men succeed in their
> ways,
> > > when they
> > >       carry out their wicked schemes."
> > >                             Psalms 37:7
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 5: Have you checked our extensive FAQ?
> > >
> > >
> > > http://www.postgresql.org/docs/faqs/FAQ.html
> > >
> > >
> >
> > =====
> > Best wishes
> > Z C Wang
> >
> >
> >
> >
> >
> >
>
___________________________________________________________ALL-NEW
> Yahoo! Messenger - all new features - even more fun!
>  http://uk.messenger.yahoo.com
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
>
>
> --
> Bill Moran
> Potential Technologies
> http://www.potentialtech.com
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
>       subscribe-nomail command to
> majordomo@postgresql.org so that your
>       message can get through to the mailing list
> cleanly
>
>

=====
Best wishes
Z C Wang





___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com 

Re: postgresql and smp linux kernel

From
Bill Moran
Date:
zhicheng wang <wang_zc@yahoo.co.uk> wrote:
> Thanks for the clear answer.
>
> What about hyper-threading? At the moment, I have
> hyper-threading enabled and the OS sees four CPUs (two
> physical and two virtual). Do these two virtual ones
> really work as the real ones?

This question really belongs on the list for the OS you're using.  It's
much more dependent on the OS than PostgreSQL.

However, if you're using FreeBSD 5, I can say from experience that
PostgreSQL makes full use of hyperthreaded processors when running on
FreeBSD 5.

If you're not running FreeBSD 5, someone else will have to answer.

> I am asking these because we use SAN disks and the
> secure-path (a fail safe mechanism) only support UP
> kernel. I have to choose do we run smp or do we make
> use of secure-path.
>
> Regards
> cheng
>
>
>
>  --- Bill Moran <wmoran@potentialtech.com> wrote:
> > zhicheng wang <wang_zc@yahoo.co.uk> wrote:
> >
> > > Thanks Oliver Elphick
> > > does this mean that the applications do not need
> > to be
> > > multi-threading in order to use multi-processors?
> >
> > Yes, that's what it means.  Although you've probably
> > oversimplified it
> > too much.  Multi-process applications make use of
> > multiple processors
> > just as well as multi-threaded apps do.
> >
> > >  --- Oliver Elphick <olly@lfix.co.uk> wrote:
> > > > On Mon, 2004-08-09 at 11:10, zhicheng wang
> > wrote:
> > > > > Dear all
> > > > >
> > > > > i have a dedicated server mainly running
> > > > postgresql,
> > > > > currently rh-posgtresql-7.3.6.7 (and samba,
> > ypbind
> > > > > etc). The server is a dual processor machine
> > and
> > > > the
> > > > > OS is RHEL AS 3.
> > > > >
> > > > > I am currently running
> > > > kernel-smp-2.4.21-15.0.4.EL.
> > > > >
> > > > > My question is: do i need to run smp kernel
> > for
> > > > > postgresql? What is benefit of it? If I run UP
> > > > kernel,
> > > > > what do I lose from the point view of PG?
> > > >
> > > > You do not NEED it for Pg, but it will improve
> > > > performance.  Each
> > > > separate session gets a different process and
> > > > therefore has a change to
> > > > run on the second processor concurrently with
> > > > another session on the
> > > > first processor.  The same goes for any other
> > > > processes that are
> > > > running, of course.
> > > >
> > > > If you do not use an SMP kernel, one of your
> > > > processors will sit there
> > > > for ever doing nothing, which is money down the
> > > > drain.
> > > >
> > > > --
> > > > Oliver Elphick
> >
> > > >    olly@lfix.co.uk
> > > > Isle of Wight
> > > > http://www.lfix.co.uk/oliver
> > > > GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E
> > 1EC0
> > > > 5664 7A2F A543 10EA
> > > >
> > > > ========================================
> > > >      "Be still before the LORD and wait
> > patiently
> > > > for him;
> > > >       do not fret when men succeed in their
> > ways,
> > > > when they
> > > >       carry out their wicked schemes."
> > > >                             Psalms 37:7
> > > >
> > > >
> > > > ---------------------------(end of
> > > > broadcast)---------------------------
> > > > TIP 5: Have you checked our extensive FAQ?
> > > >
> > > >
> > > > http://www.postgresql.org/docs/faqs/FAQ.html
> > > >
> > > >
> > >
> > > =====
> > > Best wishes
> > > Z C Wang
> > >
> > >
> > >
> > >
> > >
> > >
> >
> ___________________________________________________________ALL-NEW
> > Yahoo! Messenger - all new features - even more fun!
> >  http://uk.messenger.yahoo.com
> > >
> > > ---------------------------(end of
> > broadcast)---------------------------
> > > TIP 4: Don't 'kill -9' the postmaster
> >
> >
> > --
> > Bill Moran
> > Potential Technologies
> > http://www.potentialtech.com
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please
> > send an appropriate
> >       subscribe-nomail command to
> > majordomo@postgresql.org so that your
> >       message can get through to the mailing list
> > cleanly
> >
> >
>
> =====
> Best wishes
> Z C Wang
>
>
>
>
>
> ___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more
fun! http://uk.messenger.yahoo.com 
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly


--
Bill Moran
Potential Technologies
http://www.potentialtech.com