Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26607

    Hi,

    In terms of performance and memory usage, is it better to use the pd4ml jsp transform tag or is it better to use PD4ML API calls in servlet code? Does it make any difference?

    Secondly, if multiple website users are going to generate pdfs (using the pd4ml transform tag) from the same jsp source code at the same time is this a problem? In the servlet created from the compiled jsp (that uses the transform tag) I saw that the org.zefer.pd4ml.taglib.PD4MLTransformerTag variable was created as a local variable in the service method and therefore should be thread-safe, right?

    I would be very grateful for your advice.

    Thanks,
    Josh

    #28663

    1. PD4ML JSP taglib is a lightweight wrapper for PD4ML API – from resource consumption perspective it makes almost no difference which approach is in use. However we recommend to use the taglib where possible, as it implicitly solves some HTTP-specific issues you may face using “naked” PD4ML API in webapp scenarios (it sets correct cache control HTTP headers to avoid failures of particular combinations of MS IE+Acroread etc)

    2. PD4ML is thread safe (the shared internal resources are protected from race conditions and dead locks), but its methods are not re-enterant: you should not call render() methods of a single PD4ML instance from multiple threads simultaneously. The best practice would be to create a new PD4ML instance for each conversion request. Multiple PD4ML instances may work safe in parallel, but you should take into account – HTML rendering is a resource consuming task. Too many processes may take too many system resources.

    Here is some useful info about:
    http://pd4ml.com/performance.htm

    #28664

    Thanks very much indeed for your response – it is much appreciated!!

    I couldn’t see where the render() method gets called when using the taglib. However, if the org.zefer.pd4ml.taglib.PD4MLTransformerTag variable is a local variable, I assume that the render() method belonging to the same pd4ml instance is not called by more than one thread at a time?

    Thanks for the performance warning about executing multiple conversions simultaneously. We want to allow customers on our website to generate pdf quotations from the jsp page which displays their shopping basket. We anticipate a maximum of 100 quotes per day. However, I am very concerned about putting too much load on system resources and will certainly monitor it. I may have to change the default quote option from pdf format to excel format (which is the format we have been using all along).

    #28665

    The taglib wraps PD4ML API thread-safe way – so there is no need to care about the API utilization.

    Just for your info: render() is called in doEndTag() method of PD4MLTransformerTag class (the method is triggered by closing )

    #28666

    Thanks a lot for the info – it has been very helpful to me!

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘General questions / FAQ’ is closed to new topics and replies.