Server Speed and rendering

297 views
Skip to first unread message

rrbot

unread,
Jan 3, 2012, 11:50:34 PM1/3/12
to dompdf
HI all. I've had great success with this library. I'm currently
rendering PDFs from 3 to 15 pages some of which contain images at
2056x2056, scaled down to fit on the page. This is to provide better
resolution from what is in effect a 72dpi image.

These documents though take about 1.5 minutes to render. If I need to
add a few sets of these, I quickly time virtual private server I'm on
out, locking up all it's resources for that time frame.

We are thinking of moving to a better server, which brings me to my
question. How much of a performance gain would I see by moving to an
upgraded server with more ram and a faster processor? Is there
anything specific I should look for in a server to speed up rendering?
Quad Core, etc?

Thanks

Fabien Ménager

unread,
Jan 4, 2012, 2:05:32 AM1/4/12
to dom...@googlegroups.com
Hello, I'm working on a patch for dompdf dealing with big PNG images with alpha channel, it takes like 5 times less time to render. But it uses a PECL extension that you need to compile (gmagick, which uses the GraphicsMagic library).
Are your images PNG with alpha channel ?

BrianS

unread,
Jan 4, 2012, 6:35:16 PM1/4/12
to dom...@googlegroups.com
We haven't done a lot of benchmarking of the image-processing features. I think once we've addressed some of the outstanding major issues we'll be able to spend more time on this. There are two areas that we'll have to look at: a code internals perspective and the capabilities of PHP and the used extensions.

I'm not sure if PHP/GD is capable of taking advantage of multiple cores but I would guess that you would see the biggest boost from a faster processor and more memory. Since this is your own server you may want to check out the work Fabien is developing using the PECL extension as well.

Also, if you can post a sample document we can take a look at what you're doing to see if we can offer any other suggestions in the meantime.

rrbot

unread,
Jan 11, 2012, 12:36:57 PM1/11/12
to dompdf
Images do not have alpha. Will your solution speed non alpha images
up?

rrbot

unread,
Jan 11, 2012, 1:07:19 PM1/11/12
to dompdf
I can't really post an example, but here's some code:

<style>
.drawing-image{
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
filter:
progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
transform-origin: 38% 54%;
}
</style>

Then in a loop, I render for different images as so:


<div class="image-block" style="page-break-after:always">
<h5 style="padding-left:10px;">Perspective Render</h5>

<?
$image_path = "configurator/files/images/".$img->id.".".
$img->extension;
?>
<img src="<? echo $image_path; ?>" class="drawing-image"
height="655px"/>
<img src="configurator/images/title-block.jpg"
height="83px" style="margin-top:190px;margin-left:1px;"/>



</div>



Specifications on the images are 2550x1920 pixels at 72dpi. I've run
some very basic unscientific tests on the rotating, and I don't think
it's the source of the timing issues. It looks to be related to the
sizes of the images file size.

I've read having content extend off the page can cause issues with
loops. Could this be an issue?

I think my best solution for now is to render these pages separately
and combine them after rendering.

Thanks for your help and input.

Fabien Ménager

unread,
Jan 11, 2012, 4:13:27 PM1/11/12
to dom...@googlegroups.com
The latest commit may help, but the only way to know the answer is to try it.
You can download the latest version from the SVN repository or download it from BrianS' page : http://eclecticgeek.com/dompdf/ (the nightly).
To take the advantage of this change, make sure you installed the gmagick PECL extension by going to www/setup.php from dompdf in your web browser.
Reply all
Reply to author
Forward
0 new messages