HTTPServer and images

28 Nov 2009

I tried to spice up the HTML page on MBED with an image, and got a very poor performance, with image getting "broken" most of the times. I started with 16kB .png file, then compressed it to 6kB .gif, and still have the problem. When the image is loaded directly, it shows up. When I put it into index.htm, I can't get it to load consistently.

I think it might have something to do with timeouts and number of simultaneous transfers. Looks like Google Chrome gives up on HTTPServer after few seconds (Google Chrome resource monitor shows about 10 seconds of file transfer). Same problem happens with FireFox.

Also, there is no caching policy given by HTTPServer for any files, which causes the image to load every time it is used, which severely hits the performance. Part of the problem is it does not give file datestamp in the headers either, so adding caching policy would be useless.

Is dropped transfers a known problem? Are there are any workarounds?

Any plans for datestamps and caching instructions in the headers?

28 Nov 2009

Hi Ilya,

 

Ilya I wrote:
I tried to spice up the HTML page on MBED with an image, and got a very poor performance, with image getting "broken" most of the times. I started with 16kB .png file, then compressed it to 6kB .gif, and still have the problem. When the image is loaded directly, it shows up. When I put it into index.htm, I can't get it to load consistently.

I have a http page (1.7 kByte) which loads 2 JavaScript files (64kByte & 1.3 kByte) and 2 images (7.8 kByte & 2.1 kByte) and a CSS Style sheet (4 kByte). This loads in Chrome, Firefox and Internet Explorer in under 10 seconds which is as you said very slow. I get sometimes a broken picture with the smaller image and in Firefox it likes to stay broken in the cache.

I've tried a loot to make it faster. Some month ago I had everything loaded in ca. 4seconds but this was not working in all my environments and even now the most people have problems with the stack so I will continue to search for the problem and If everything is working reliable I try to speed things up.

 

 

28 Nov 2009 . Edited: 28 Nov 2009

... Well wrong button

Ilya I wrote:
I think it might have something to do with timeouts and number of simultaneous transfers. Looks like Google Chrome gives up on HTTPServer after few seconds (Google Chrome resource monitor shows about 10 seconds of file transfer). Same problem happens with FireFox.

I'm pretty sure it does! I guess its as well the speed between requests and things like TCP out of oder packets.

It looks like it realy confuses the lwip implementation.

Yesterday I found rely able a way to receive the google start page with the HTTPClient and I did never receive the same 900 Byte in the middle of the page.

Ilya I wrote:
Also, there is no caching policy given by HTTPServer for any files, which causes the image to load every time it is used, which severely hits the performance. Part of the problem is it does not give file datestamp in the headers either, so adding caching policy would be useless.

You can add one if you wish with the HTTPFields handler. But as you said it might not work without timestamp ;-)

Ilya I wrote:
Is dropped transfers a known problem? Are there are any workarounds?

Yes and No. It even looks like that the dropping rate highly depend on the network environment. Long cable, much traffic, lots of routers, ...

Ilya I wrote:
Any plans for datestamps and caching instructions in the headers?

Not directly, but with the RTC and an HTTPFields like handler it easy to implement, might be a good idea, I will think about ;-)

 

Thanks for the post

Cheers

Rolf

29 Nov 2009

Rolf,

Thanks for the info!

MBED is pretty amazing tool even being in rough around the edges shape as it is now. I am pretty certain that you have your plate full, and more things will get better over time. I'm glad if my information helps in any way.

Regards,

Ilya