PostgreSQL and mod_perl trouble (spinlock)

Started by Patrick Verdonover 27 years ago3 messagesgeneral
Jump to latest
#1Patrick Verdon
patrick@kan.co.uk

Hi,

I've been doing some benchmarking with PostgreSQL
under mod_perl and I've been getting some rather
disturbing results. To achieve the maximum benefit
from persitent connections I am using a method
called 'connect_on_init' that comes with a Perl
module called Apache::DBI. Using this method,
when the Web server is first started - each child
process establishes a persistent connection with
the database. When using PostgreSQL as the database,
this causes there to be as many 'postgres'
processes are there are 'httpd' processes
for a given database.

As part of my benchmarking I've been testing the
number of httpd processes that my server can
support. The machine is a 450 MHz PII/256 MB RAM.
As an excercise I tried to start 100 httpd
processes. Doing this consistently results in the
following PostgreSQL errors and the backend usually
dies:

IpcSemaphoreCreate: semget failed (No space left on device) key=5432017, num=16, permission=600
NOTICE: Message from PostgreSQL backend:
The Postmaster has informed me that some other backend died abnormally and possibly corrupted shared memory.
I have rolled back the current transaction and am going to terminate your database system connection and exit.
Please reconnect to the database system and repeat your query.

FATAL: s_lock(28001065) at spin.c:125, stuck spinlock. Aborting.

Note that the 'no space left on device' is
misleading as there is a minimum of 400 MB
available on each file-system on the server.

This is obviously bad news, especially as we are
hoping to develop some fairly large-scale
applications with PostgreSQL. Note that this
happens when connecting to a single database.
We were hoping to connect to several databases
from each httpd process!!

The frustrating thing is we have the resources.
If I only start 30 processes (which seems to be
the approximate limit) there is about 100 MB
of RAM that is not being used.

Are there any configuration values that control
the number of postgres processes? Do you have
any idea why this is happening?

Is anyone else using Apache/mod_perl and PostgreSQL
successfully in a demanding environment?

Any help would be greatly appreciated.

Cheers.

Patrick

--

#===============================#
\ KAN Design & Publishing Ltd /
/ T: +44 (0)1223 511134 \
\ F: +44 (0)1223 571968 /
/ E: mailto:patrick@kan.co.uk \
\ W: http://www.kan.co.uk /
#===============================#

#2Egon Schmid
eschmid@stuttgart.netsurf.de
In reply to: Patrick Verdon (#1)
Broken Link

If I follow "News Flash" which leads me to
http://looking-glass.usask.ca/postgresql/ there is a broken link for the
PostgreSQL/PHP tutorial, Linux, SQL, and the Web. It points to
http://www.bigfoot.com/~charles_fisher/uw/018.html. But actually it leads
to http://cs.sau.edu/~cfisher/uw/018.html. The DNS name lookup fails on
cs.sau.edu. BTW the german meaning of sau is pig :)

-Egon

#3Ryan Schutt
rschutt@vt.edu
In reply to: Patrick Verdon (#1)
Re: [GENERAL] PostgreSQL and mod_perl trouble (spinlock)

We have been encountering the exact same problems with our mod_per +
postgresql set up. It has been driving us absolutely batty for the past few
months. It'd be great if someone had a solution!!

-Ryan

-----Original Message-----
From: Patrick Verdon <patrick@kan.co.uk>
To: pgsql-general@postgreSQL.org <pgsql-general@postgreSQL.org>
Date: Sunday, January 24, 1999 12:26 PM
Subject: [GENERAL] PostgreSQL and mod_perl trouble (spinlock)

Hi,

I've been doing some benchmarking with PostgreSQL
under mod_perl and I've been getting some rather
disturbing results. To achieve the maximum benefit
from persitent connections I am using a method
called 'connect_on_init' that comes with a Perl
module called Apache::DBI. Using this method,
when the Web server is first started - each child
process establishes a persistent connection with
the database. When using PostgreSQL as the database,
this causes there to be as many 'postgres'
processes are there are 'httpd' processes
for a given database.

As part of my benchmarking I've been testing the
number of httpd processes that my server can
support. The machine is a 450 MHz PII/256 MB RAM.
As an excercise I tried to start 100 httpd
processes. Doing this consistently results in the
following PostgreSQL errors and the backend usually
dies:

IpcSemaphoreCreate: semget failed (No space left on device) key=5432017,

num=16, permission=600

NOTICE: Message from PostgreSQL backend:
The Postmaster has informed me that some other backend died abnormally and

possibly corrupted shared memory.

I have rolled back the current transaction and am going to terminate your

database system connection and exit.

Show quoted text

Please reconnect to the database system and repeat your query.

FATAL: s_lock(28001065) at spin.c:125, stuck spinlock. Aborting.

Note that the 'no space left on device' is
misleading as there is a minimum of 400 MB
available on each file-system on the server.

This is obviously bad news, especially as we are
hoping to develop some fairly large-scale
applications with PostgreSQL. Note that this
happens when connecting to a single database.
We were hoping to connect to several databases
from each httpd process!!

The frustrating thing is we have the resources.
If I only start 30 processes (which seems to be
the approximate limit) there is about 100 MB
of RAM that is not being used.

Are there any configuration values that control
the number of postgres processes? Do you have
any idea why this is happening?

Is anyone else using Apache/mod_perl and PostgreSQL
successfully in a demanding environment?

Any help would be greatly appreciated.

Cheers.

Patrick

--

#===============================#
\ KAN Design & Publishing Ltd /
/ T: +44 (0)1223 511134 \
\ F: +44 (0)1223 571968 /
/ E: mailto:patrick@kan.co.uk \
\ W: http://www.kan.co.uk /
#===============================#