Re: Queues Problem - Mailing list pgsql-general

From Vick Khera
Subject Re: Queues Problem
Date
Msg-id AANLkTikmW9r1Eo1JxJJ2h80kIR9EtTg3GEYfsm73uwZx@mail.gmail.com
Whole thread Raw
In response to Queues Problem  (uaca man <uacaman@gmail.com>)
Responses Re: Queues Problem  (uaca man <uacaman@gmail.com>)
List pgsql-general
On Tue, Jun 8, 2010 at 12:53 PM, uaca man <uacaman@gmail.com> wrote:
> Lets say for a 20 thousand users server, it may have at most 20 thousand
> constructions started at the same time.
>
> To accomplish such behavior so far I could come up with two options:
>
> 1.       Make a never ending function that will look at the   BuildingQueue
> table every second and finish the construction.
>
> 2.       Every time the user start a construction add a cron job for that
> construction to run 1 seconds after the construction is finished and call a
> function the will finish.

You should investigate a proper queueing or job scheduling solution,
such as RabbitMQ or Qpid or gearman.  They are designed for this type
of requirement.  You will have to write your code to be more event
driven, and make the web server just generate requests and view the
results where they are stored.

pgsql-general by date:

Previous
From: Chris Browne
Date:
Subject: Re: Cognitive dissonance
Next
From: Justin Graf
Date:
Subject: Re: Cognitive dissonance