pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew McMillan <andrew@catalyst.net.nz>
To: YC Nyon <ycnyon@pd.jaring.my>
Cc: pgsql-php@postgresql.org
Subject: Re: Spaawn another process
Date: 07 Nov 2002 22:42:33 +1300
Message-ID: <1036662153.20144.907.camel@kant.mcmillan.net.nz> (raw)
In-Reply-To: <004b01c2855b$42e50a60$5340baca@gis>
References: <004b01c2855b$42e50a60$5340baca@gis>

On Wed, 2002-11-06 at 19:09, YC Nyon wrote:
> In my PHP page, I need to run a external program to insert map data into
> Postgresql. However, the process is very slow (can be 10 mins). How do I
> return a webpage telling the user that the process is running and permits
> the user to browse the other parts of the web application.
> 
> My idea is to run the "exec();" after the </html> tag. Would that be the
> way?

I would tend to not start it from PHP, but to write enough details into
a "queue" table which would be processed in sequence by a background
task.

This approach:

a) simplifies your PHP a bit,

b) avoids the issue of 'when' entirely,

c) lets you write status into the queue table and have a page that tells
them it's 50% done, or is next in the queue, or whatever,

 and

d) makes the handling of 10, 20 or 30 minute jobs one which hits the
database serially, rather than in parallel (or you can control the
parallelism to a level your equipment can handle).


Cheers,
					Andrew.
> 
> TIA
> Nyon
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
-- 
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/         PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201     MOB: +64(21)635-694    OFFICE: +64(4)499-2267
           Survey for nothing with http://survey.net.nz/ 
---------------------------------------------------------------------




view thread (6+ messages)  latest in thread

Message-ID: <1036662153.20144.907.camel@kant.mcmillan.net.nz>
Permalink:  ../1036662153.20144.907.camel@kant.mcmillan.net.nz/
Also on:    postgresql.org/message-id/1036662153.20144.907.camel@kant.mcmillan.net.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: andrew@catalyst.net.nz, ycnyon@pd.jaring.my
  Subject: Re: Spaawn another process
  In-Reply-To: <1036662153.20144.907.camel@kant.mcmillan.net.nz>
  References: <004b01c2855b$42e50a60$5340baca@gis> <1036662153.20144.907.camel@kant.mcmillan.net.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox