Grzegorz Kossakowski wrote: > [EMAIL PROTECTED] 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 in > o.a.c.components.pipeline.AbstractProcessingPipeline#process() method. > > After quite simple implementation you could use something like: > <map:pipeline> > <map:parameter name="processInQueue" value="true"/> > <map:parameter name="maxSimultaneousProcessings" value="5"/> > > [put your reader here] > </map:pipeline> > > I think it's worth to wait for other ideas before implementing this. > It depends on the exact use case and the requirements, but limiting the pipeline might create a real bottleneck. Imagine several clients with each one requesting several images at the same time.
I would rather try to do some offline generation of the images and store them in the cache and deliver them from cache only. But of course this depends on the nature of the images like if they change very often or if the representation various depending on the client etc. Carsten -- Carsten Ziegeler [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]