Large Static Images

Dear Friends,

We are working on a shop currently which has rather large product-images. The loading takes a while, with much room for improvement.

I was wondering if anyone has used any special strategies to improve the latency in loading such heavy static content.

I image sizes on an average are 700KB, which we are not able to avoid because of the high-quality required by customer.

TIA
Ashant

Still scraping for a solution for this problem…

One thought is to store the images on a separate machine, driven by something like a high-performance static content delivery server like nginx (does anyone know of a faster server?). Then point to this server using a config variable in the config.inc.php. However the current OXID architecture doesn’t yet allow for this.

One of the strategies advised on the web is to use mod_deflate and mod_gzip. However this doesn’t seem to be a viable solution for image-data. Nevertheless, something to be tried out.

Hi Ashant,

using a separate dedicated nginx (or similar) server for static images definitely speeds things up.

There are several ways to change the URL base for images. One of the simplest is to write a small module that extends OxCategory & OxArticle, replacing their getPictureUrl() functions with your own version. The URL string can be stored in config.inc.php and loaded via getConfigParam().

CPJ

cpjolly - Thank you for the tip. I think this will take care of the problem for us.

One more thing…

Have you tried to host the image-server and the OXID-instance on the same machine, under different sub-domains (or alternatively ports)? I mean the different subdomains and ports will be served by different webservers (nginx for image content). If so, how has your experience with performance been in this scenario?

Thanks & regards
Ashant

Hi Ashant,

It will work on a single server, but the question of one machine or 2 (or more) is really the same as the generic issue of balancing expected loading with available resources - 2 CPU cores are better than 1, 4GBytes of RAM is better than 2, 2 servers are better than 1…

So, it’s totally dependent on how busy the site will be and if the available resources provide an acceptable customer experience. By the way, if you’re looking for more detailed help in this area, the guys at http://www.syseleven.de are expert at load balancing and performance management.

CPJ

Check out http://fwd4.me/iGv and some sample config for NGINX at http://fwd4.me/iGw. According to this it seems that we can run the two servers on two different ports (same IP). Not sure if a separate subdomain is needed, but that comes at no cost, hence unproblematic.

This way we should just be able to set the NGINX conf file to load http://img.myshop.com:801 from the standard OXID ~/out/pictures/ folder.

Wonder how SSL pages will work in this scenario though.

Ashant

Different ports on the same IP will work but using 2 IPs is definitely preferable, especially if you expect to have a need in the future to split the work between two servers. SSL will continue to work, since it’s also just another port number on the same IP.

CPJ

In that case we need to remain with the same subdomain, right? So better to use www.myshop.com:801 and not img.myshop.com:801?

Hi Ashant,

If you only have one IP address and one server, it doesn’t matter if you use a different subdomain or a different port number for the images location.

However, anything above the most basic hosting package usually allow additional IPs to be purchased for a reasonable fee, and my personal preference would be to take this route from the start.

Assuming you want a proper verified SSL certificate, you’ll need to take into account the normal rules the issuers have about IP addresses, domain names, subdomains and wildcards etc.

If your customer can afford a verified SSL certificate, he should be able to at least afford an appropriate Virtual Machine hosting package that includes a couple of IP addresses and a few domains. Most of these types of hosting packages also provide free access to Plesk or your perferred administration tool, which I find are a big help to install & maintain complex environments like this.

CPJ

Hi CPJ,

At this point the need is a precautionary one, and we are trying to proactively solve the problem, so that customers have an option once the shop-load scales. I think we’ll be able to persuade the customer to take up the additional costs.

On our test machines we do have enough machines, IPs etc to play out any of the above discussed options.

Thanks a ton for your inputs. I will try to remember to report back our results here, and (before Marco puts in his reminder) document on the Wiki :slight_smile:

Ashant

before Marco puts in his reminder) document on the Wiki

LOL! Thanks mates! :slight_smile:

Hello All,

Here’s a write-up on using NGINX for loading OXID static content.

I had to write it in a hurry, but hope the main points come across, and I’ll try to complete the articles shortly.

Regards
Ashant

Hi Ashant,

when finalized it, please feel free to add a link to the Tutorials section of OXID forge:

Thanks and regards