Ampoule job runner should not run in launchpad environment

Bug #497072 reported by Aaron Bentley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

The ampoule-based job runner is slower than the synchronous job runner because it needs to start up two launchpad environments-- one for the master process and one for the subprocess.

Instead, the ampoule-based job runner should defer all work that requires a launchpad environment to the subprocess.

Currently, two significant operations require a launchpad environment:
1. Finding available jobs to run
2. Reporting oopses when a job terminates uncleanly

Since our ampoule-based job running script may become a daemon, the master process should be as simple as possible. By shoving all this work into subprocesses, we reduce the scope for resource leaks and abnormal termination in the master process. Child processes can, of course, be killed.

Revision history for this message
Jonathan Lange (jml) wrote :

By "start up two launchpad environments", I presume you mean "process launchpad's zcml"?

Why not have all the Launchpad stuff done in the job runner, leaving the subprocess nice and fast to start?

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 497072] Re: Ampoule job runner should not run in launchpad environment

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan Lange wrote:
> By "start up two launchpad environments", I presume you mean "process
> launchpad's zcml"?

That is all we currently do, but there may be more that we should be doing.

> Why not have all the Launchpad stuff done in the job runner, leaving the
> subprocess nice and fast to start?

That would mean that the subprocess would not have access to any of our
normal facilities, such as zope utilities or the database. Operations
which required those facilities would have to be performed by the master
process. We want to make the master process simpler, but this would
make it more complex instead. It would greatly increase the likelihood
of resource leaks in the master process. Jobs themselves would become
harder to write, and I expect some would have to be split into several
AMP commands.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkspO4IACgkQ0F+nu1YWqI19PACeO94L7WcQ/7UEaAXquyw/hKsG
OkAAn0Grl0cSu02DG7tuxyRZqgb7gu4L
=mGM8
-----END PGP SIGNATURE-----

Revision history for this message
Jonathan Lange (jml) wrote : Re: [Bug 497072] Re: Ampoule job runner should not run in launchpad environment

On Thu, Dec 17, 2009 at 6:56 AM, Aaron Bentley <email address hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jonathan Lange wrote:
>> By "start up two launchpad environments", I presume you mean "process
>> launchpad's zcml"?
>
> That is all we currently do, but there may be more that we should be
> doing.
>
>> Why not have all the Launchpad stuff done in the job runner, leaving the
>> subprocess nice and fast to start?
>
> That would mean that the subprocess would not have access to any of our
> normal facilities, such as zope utilities or the database.  Operations
> which required those facilities would have to be performed by the master
> process.  We want to make the master process simpler, but this would
> make it more complex instead.  It would greatly increase the likelihood
> of resource leaks in the master process.  Jobs themselves would become
> harder to write, and I expect some would have to be split into several
> AMP commands.
>

OK. It's a matter of trade-offs then. The branch puller forces almost
all of the database stuff onto the master process precisely to avoid
the long start-up times of processing zcml. When you have tens of
thousands of jobs a day, seconds count.

I agree that it does make resource leaks more likely. I can believe
that it would make jobs harder to write, but I'd like to know more of
the specifics.

I don't want to block progress on this bug by demanding perfection
rather than improvement, however, perhaps it's worth challenging Gary
& the Foundations team with the slow ZCML problem. After all, if it
were lightning fast, none of this would be a problem (and we could
simplify much of our existing code).

jml

Revision history for this message
Aaron Bentley (abentley) wrote :

I don't think the start-up costs of subprocesses are relevant here, because we will not be starting new subprocesses for each job. Ampoule is a process pool, and we can reuse the subprocesses as many times as we like.

Revision history for this message
Jonathan Lange (jml) wrote :

On Thu, Dec 17, 2009 at 5:22 PM, Aaron Bentley <email address hidden> wrote:
> I don't think the start-up costs of subprocesses are relevant here,
> because we will not be starting new subprocesses for each job.  Ampoule
> is a process pool, and we can reuse the subprocesses as many times as we
> like.

Ahh, I see. That makes much more sense.

jml

Revision history for this message
Robert Collins (lifeless) wrote :

FWIW oopses can be done outside zope/zcml easily now.

Changed in launchpad:
importance: Medium → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.