|
GZIP and Charts from Chartdirector |
Posted by icm63 on Jun-07-2011 16:12 |
|
Project: asp.net 2.0
webServer : IIS7.5
I have become very good at GZIP with IIS7.5.
My ChartD generates a png chart. That is between 10 and 150 KBs, average 60kb.
I cache charts png images on server side cachecontrol. Thats helps.
I tried to set GZIP for both static and dynamic like this, in the web config.
<add mimeType="image/png" enabled="true"/>
In the code attached it has been removed.
GZIP of image/png HAD NO EFFECT on the chartD chart image. My Fiddler2 shows that the ChartD png image was NO compressed.
QUESITON: Is this the way it is, or can I do something to make my ChartD images compressed, or the KB chartD image smaller.
(NOTE: Please dont tell me to make charts smaller, less indicators, etc).
|
Re: GZIP and Charts from Chartdirector |
Posted by icm63 on Jun-07-2011 16:23 |
|
I am currently showing charts in png.
I understand that jpeg or jpg is 20% less in size, but of a lessor quality.
See the two images attached.
I assume switch between JPG and PNG as no effect on code and functionality.
What your view on the above selection ?? Its JPG worth a 20% saving in KBs.
(NOTE: I assume you concur JPG is smaller than PNG) |
Re: GZIP and Charts from Chartdirector |
Posted by Peter Kwan on Jun-07-2011 22:38 |
|
Hi icm63,
According to the PNG standard, the PNG is already compressed with GZIP internally. Compress it one more time has very little or no effect. As a test, you can use GZIP it to compress a static PNG image and verify that it has no effect.
It is true that JPG has lower quality. However, as far as I know, there is no rule that states that JPEG is 20% less in size. In fact, from my experience, JPEG can be larger than PNG or smaller than PNG. It depends on the nature of the image. If the image is photograph like, JPEG is likely much smaller than PNG. If the image is artificial (cartoon like), JPEG is likely to be larger than PNG.
It is true that switching between JPG and PNG has no effect on the code and and functionality.
Hope this can help.
Regards
Peter Kwan |
Re: GZIP and Charts from Chartdirector |
Posted by icm63 on Jun-09-2011 13:22 |
|
My asp.net project has to use IIS7.5. You maybe as well. (PHP uses IIS7.5 I think)
Anyways. I am using this type of cache setup, see below.
I refer you to PNG setup. First line under profiles. I believe this is for STATIC files and not dynamic which is what ChartD outputs I presume.
The ChartD format I use is PNG. How will my caching effect chartd output. Changes to charts content, layers, indicators etc. I dont want the ChartD charts to be cached, as I need them to change on postback.
My website, does have static png images for icons, etc.
How do you IIS 7.5 static PNG versus ChartD PNG output?
code.txt |
---|
<!--CACHEPOLICY 7776000 is 90 Days-->
<caching enabled="true" enableKernelCache="true">
<profiles >
<clear/>
<add extension=".png" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client" />
<add extension=".gif" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client" />
<add extension=".jpg" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client" />
<add extension=".jpeg" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client" />
<add extension=".js" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client" />
<add extension=".css" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client" />
<add extension=".axd" kernelCachePolicy="CacheUntilChange" varyByHeaders="User-Agent" location="Client" />
</profiles>
</caching>
<httpProtocol allowKeepAlive="true">
<customHeaders>
<clear/>
<add name="Cache-Control" value="public, max-age=7776000" />
</customHeaders>
</httpProtocol>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="90.00:00:00" />
</staticContent> |
| |
Re: GZIP and Charts from Chartdirector |
Posted by Peter Kwan on Jun-09-2011 18:22 |
|
Hi icm63.
Your cache does not cache PNG. It caches files with ".png" extension.
If your system is configured to deliver the charts to the client on the fly (without creating temporary files), then the charts are not with ".png" extension (they are PNG but there is no file extension, as there is no file). So your cache is not applicable to them.
If you are using BaseChart.makeTmpFile to create the charts as temporary files on the hard disk, the files do have ".png" extension. However, the filename is different for every chart, so the cache has no effect. (The same filename is never used twice.)
Hope this can help.
Regards
Peter Kwan |
Re: GZIP and Charts from Chartdirector |
Posted by icm63 on Jun-10-2011 01:02 |
|
Thats why you get paid the big bucks !
I was watching Fiddler2 report, the chart is sent as image/png.
But thats NOT a file, ie an extension !
Thanks !
ALL those wishing to GZIP and CACHE in IIS7.5 (ASP.net) use my web.config code, if you have any better advice or better settings add it here ! |
|