cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <>
Subject Re: How to limit number of instances of component?
Date Wed, 29 Aug 2007 09:35:50 GMT pisze:
> I'm trying to use the imageop block, but its rather resource
> intensive. I get out of memory errors.
> This happens because I generate a number of thumbnails on a page and
> the browser requests all images from the server at once. Then cocoon
> creates a pipeline for each request in parallell and out of memory
> occurs.

I hope that you use caching so every thumbnail is generated only once. Do you?

> How can I limit the number of parallell instance of a pipeline?
> I tried pool-max on the resizer like this:
>     <map:reader logger="imageop" name="image-op-resize-pool-max" src="org.apache.cocoon.reading.imageop.ImageOpReader"
>                 pool-max="2">
> but it appears that pool-max only limits the number of instances in
> the pool, not the total number of instances. when the pool is filled,
> new instances are created outside the pool.

Yes, pool-max will not help you in this case, it's not hard limit by any means.

> I could maybe set session-max on the container, but that would affect
> the entire system.
> I could also maybe do some client side javascript hackery to request
> the images in sequence, but I'd rather not.
> I want something like a queue rather than a pool.

I suspect that you use Cocoon 2.1, right?

Your question is quite interesting and I don't have any simple solution off the top of my
head. Not
so simple but most elegant would be to implement processing queue for particular pipeline
o.a.c.components.pipeline.AbstractProcessingPipeline#process() method.

After quite simple implementation you could use something like:
  <map:parameter name="processInQueue" value="true"/>
  <map:parameter name="maxSimultaneousProcessings" value="5"/>

  [put your reader here]

I think it's worth to wait for other ideas before implementing this.

Grzegorz Kossakowski

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message