Thread: Problems with listen / notify

Problems with listen / notify

From
Rafael Martinez
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello

I am experiencing some strange behaviour with listen/notify via psycopg2.

When executing multiple notifies in a server *without* problems, a
python script gets all notifies defined in a period of time in one
poll() call (as expected)

But when running the same code against a server *with* problems, the
python script gets only one notify per poll() call.

Check http://pastebin.com/9itGKxJR for details of the two runs and the
python code used for this test.

postgreSQL version: 9.2.8
python 2.6.6 (RHEL6)
psycopg version: 2.5.3-1.rhel6

Any ideas about why this is happening?
Thanks in advance.

regards
- --
 Rafael Martinez Guerrero
 Center for Information Technology
 University of Oslo, Norway

 PGP Public Key: http://folk.uio.no/rafael/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAlOhntYACgkQBhuKQurGihSZMACeMhwVvHMuk2Qm3BgXpW/r5cFb
fsEAn3IfIkr/rECFZ3mJ4NbagoGBx7fL
=VucW
-----END PGP SIGNATURE-----


Re: Problems with listen / notify

From
Karsten Hilbert
Date:
On Wed, Jun 18, 2014 at 04:14:46PM +0200, Rafael Martinez wrote:

> When executing multiple notifies in a server *without* problems, a
> python script gets all notifies defined in a period of time in one
> poll() call (as expected)
>
> But when running the same code against a server *with* problems, the
> python script gets only one notify per poll() call.

What constitutes a server "with" or "without" problems ?

I seem to remember that notify does not guarantuee to deliver
each of successive identical notifications.

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


Re: Problems with listen / notify

From
Rafael Martinez Guerrero
Date:
On 06/18/2014 04:33 PM, Karsten Hilbert wrote:
> On Wed, Jun 18, 2014 at 04:14:46PM +0200, Rafael Martinez wrote:
>
>> When executing multiple notifies in a server *without* problems, a
>> python script gets all notifies defined in a period of time in one
>> poll() call (as expected)
>>
>> But when running the same code against a server *with* problems, the
>> python script gets only one notify per poll() call.
>
> What constitutes a server "with" or "without" problems ?
>
> I seem to remember that notify does not guarantuee to deliver
> each of successive identical notifications.
>

Hello

I don't care about the order in which the script receives notifications.
My problem is that I have a particular postgreSQL server that sends only
one notification per poll() call.

A have a program that checks for new notifications from a database one
time every minute. In a "normal" server the program gets all the
notifications generated by the database during the last minute, in the
server with "problems" it gets only one every minute even if many
notifications has been generated during the last minute.

During a minute the database can generate several hundreds
notifications, if the program connects to the server with "problems", it
can take several hours to process all the notifications, while when it
is connected to a normal server it takes a few seconds.

I am just trying to understand why this server behaves in this way when
it is not overloaded at all.

Thanks for your help.

regards,
--
Rafael Martinez Guerrero
Center for Information Technology
University of Oslo, Norway

PGP Public Key: http://folk.uio.no/rafael/


Re: Problems with listen / notify

From
Adrian Klaver
Date:
On 06/18/2014 08:13 AM, Rafael Martinez Guerrero wrote:
> On 06/18/2014 04:33 PM, Karsten Hilbert wrote:
>> On Wed, Jun 18, 2014 at 04:14:46PM +0200, Rafael Martinez wrote:
>>
>>> When executing multiple notifies in a server *without* problems, a
>>> python script gets all notifies defined in a period of time in one
>>> poll() call (as expected)
>>>
>>> But when running the same code against a server *with* problems, the
>>> python script gets only one notify per poll() call.
>>
>> What constitutes a server "with" or "without" problems ?
>>
>> I seem to remember that notify does not guarantuee to deliver
>> each of successive identical notifications.
>>
>
> Hello
>
> I don't care about the order in which the script receives notifications.
> My problem is that I have a particular postgreSQL server that sends only
> one notification per poll() call.
>
> A have a program that checks for new notifications from a database one
> time every minute. In a "normal" server the program gets all the
> notifications generated by the database during the last minute, in the
> server with "problems" it gets only one every minute even if many
> notifications has been generated during the last minute.
>
> During a minute the database can generate several hundreds
> notifications, if the program connects to the server with "problems", it
> can take several hours to process all the notifications, while when it
> is connected to a normal server it takes a few seconds.
>
> I am just trying to understand why this server behaves in this way when
> it is not overloaded at all.

Well you still have not said what the differences between the 'normal'
and 'problem' servers are.

Some questions to start:

1) What are the Postgres versions of the servers?

2) Where are the different servers located, remote or local?

3) Are the notifications the same?
If they are what are they?
If not how do they differ?



>
> Thanks for your help.
>
> regards,
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Problems with listen / notify

From
Karsten Hilbert
Date:
On Wed, Jun 18, 2014 at 08:27:35AM -0700, Adrian Klaver wrote:

> Well you still have not said what the differences between the 'normal' and
> 'problem' servers are.

It starts to seem that "with problem" means the server where
he's seeing the behaviour he's asking about :-)

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


Re: Problems with listen / notify

From
Rory Campbell-Lange
Date:
On 18/06/14, Rafael Martinez Guerrero (r.m.guerrero@usit.uio.no) wrote:
> Hello
>
> I don't care about the order in which the script receives notifications.
> My problem is that I have a particular postgreSQL server that sends only
> one notification per poll() call.

I think you have run into one of the problems Tom Lane describes here:
http://postgresql.1045698.n5.nabble.com/LISTEN-NOTIFY-performance-in-8-3-td2068123.html

--
Rory Campbell-Lange