November Happy Hour will be moved to Thursday December 5th.

Issue with image gallery thumbnail generation

Vote:
 

Current setup
Customer is running EPiServer Relate on 3 server cluster. Images are added to blog post entries and thumbnails of various sizes are generated on-demand. Customer does not have dedicated SAN to store VPP or file system content.

Issue
Original EPiServer Relate+ image gallery handler is that thumbnails are generated only on physical folder on particular server which is serving the request. Below is fragment from ImageGalleryFactory (EPiServer.Community.ImageGallery.dll):

static Thumbnail CreateThumbnail(..)
{

str1 = !HostingEnvironment.IsHosted ? ImageGalleryModule.GetAbsoluteImageGalleryPath(image.ImageGalleryId) : HostingEnvironment.MapPath(ImageGalleryModule.GetVirtualThumbnailPath(image.ImageGalleryId));

}

The same code fragment could be found in AddImage() method that lacks of VPP support as well.

So if image thumbnail generation is requested in server A, that info is saved into database and cached and later on if request for the same size thumbnail is served from server B, then thumbnail info could be found in DB, but physical file could not be found, because it’s saved locally on server A. Result of this issue is that some images are missing on the site.


Workaround
Our workaround was to implement custom image gallery handler that is derived from original one. We override most overloaded GetThumbnail() method, call base method and then copy generated file to VPP storage.

public override Thumbnail GetThumbnail(
    Image image,
    int width,
    int height,
    ThumbnailFormat thumbnailFormat,
    bool createThumbnail,
    Watermark thumbnailTag,
    Color thumbBgColor)
{
    var thumbnail = base.GetThumbnail(image, width, height, thumbnailFormat, createThumbnail, thumbnailTag, thumbBgColor);

    if (createThumbnail)
    {
        if (thumbnail != null)
        {
            var fileCreated = CreateThumbnailInVPP(thumbnail);
            if (!fileCreated)
            {
                return null;
            }
        }
    }

    return thumbnail;
}

We had 2 implementations: versioned VPP provider and implementation of VPP sync from (http://world.episerver.com/Blogs/David-Knipe/Dates/2009/11/Synchronising-EPiServer-VPP-folders-using-the-Microsoft-Sync-Framework/). This somehow didn’t workout very well (not quite sure – probably of incorrect sync).
Then we configured Amazon S3 as VPP provider. This solution worked pretty OK, thumbnail files are stored physically on some server which is serving the thumbnail generation request, then immediately thumbnail file is copied over to VPP and all servers have access to shared VPP folder.

Question
Is there a better solution for image and  corresponding thumbnail handling and support for VPP storage in order to be able to survive in web server cluster scenarios?
<imageGallery> under <episerver.community> element has 2 options:
1. imageAbsoluteFilePath
2. thumbnailVirtualFilePath

which both maps to local server physical file system.

We would like to have support for storing both images and thumbnails in VPP folders.

#57526
Mar 19, 2012 14:50
Vote:
 

thumbnailVirtualFilePath actually points to a virtual directory configured in your IIS. That directory could be on a file share on another server, and files generated on one server would then be immediately available on the other servers.

You could refer this page for guidance:
http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-Community/EPiServer-Community-32/The-Cache-Replication-System/

 

Kristoffer 

#57567
Edited, Mar 21, 2012 13:35
Vote:
 

Thanks for reply,

But as I mentioned earlier file share in customer's cluster setup is not an option. We would need to push those images out to our own defined VPP location.

#57570
Mar 21, 2012 15:13
Vote:
 

So the system requirement tech-note should say: NAS/SAN required? In this case we don't have a SAN and pointing everything to a shared folder on one of the frontend servers is not an option.

Frederik

#57571
Mar 21, 2012 15:16
Vote:
 

Hi,

In the original post, it was briefly noted that the customer does not have a SAN, but otherwise this decision/requirement is not motivated. A SAN is not required to have a file share, and you probably have a database (connection/server) that have more or less the same properties that you require for the images: its data is shared between the nodes and it has local local storage.

In order to better understand your needs, could you motivate your standpoint in this matter?

Thanks!

#57572
Mar 21, 2012 15:17
Vote:
 

Frederik,

The system requirement tech-note that you mention does not specifically handle the case of web farms, which also adds other requirements that is outside the scope of the tech-note but still required to make it work. Example of that is network connectivity between the nodes in the farm (to make the cache replication work) and a load balancer solution (L7 application such as F5 BIG-IP, WLBS or round-robin DNS) between the servers in the web farm and the clients.

In addition, as you have noticed, user generated content must be shared somehow. There are easy ways to do it (explained earlier), and harder. You have already eliminated the easy way, I just want to know why. :)

#57573
Edited, Mar 21, 2012 15:27
Vote:
 

Sure, the reason that we're not allowed to use a file share is because of failover requirements by the IT department of this customer, in case that file share is unavailable.

Frederik

#57574
Mar 21, 2012 15:39
Vote:
 

That is a valid point. But I must, as a part of the discussion, ask how the database server is set up with regards to the failover requirements?

#57575
Mar 21, 2012 15:48
Vote:
 

It is in a database cluster, with mirroring in two different data centers.

Frederik

#57576
Mar 21, 2012 15:50
Vote:
 

It does sound like your solution supports the availability requirements you need.  You could also consider if DFS could be an option for synchronizing/sharing the data between the servers; whether it is stored in duplicate on each node in the database cluster, or on the frond end servers.

 

Best Regards,

Kristoffer

#57577
Mar 21, 2012 15:56
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.