Topic: Scalability

Howdy,

I am considering using Juicebox for a site with thousands of images and potentially thousands of simultaneous users. The images are stored within the Amazon S3 cloud, metadata stored on a local DB.

From what I understand we would need to :

  • Hand build code to output the config.xml file for each gallery

  • Users visiting the site would download the config.xml file locally then get the images directly from Amazon S3

I'm concerned:

  • Building an XML file of 2000 images may be very slow

  • Thousands of users downloading the XML file at once may trash the server

  • The user experience may be very slow at first as it loads the XML file for the first time

Does JuiceBox solution scale to this level (I see you support unlimited images) and how do you recommend architecting it?

Is it possible to build something similar to the Flickr connection except to our own API?

Do you have an example of a JuiceBox install with thousands of images?

Re: Scalability

Does JuiceBox solution scale to this level (I see you support unlimited images) and how do you recommend architecting it?

One of the issues of having such a large gallery would be to ensure that not all images are preloaded by the browser at once.
Juicebox caters for this with the imagePreloading option which can be set to preload all images in the current thumbnail page, the next image in the gallery only, all images in the gallery or no images at all.

Is it possible to build something similar to the Flickr connection except to our own API?

Rather than manually create an XML file listing all images to be displayed, it is possible to use PHP to include all images in a specific directory.
You could use the following embedding code:

<!--START JUICEBOX EMBED-->
<script src="jbcore/js/juicebox.js"></script>
<script>
new juicebox({
containerId : "juicebox-container",
configUrl : "config.php"
});
</script>
<div id="juicebox-container"></div>
<!--END JUICEBOX EMBED-->

... and use the following code in a file named 'config.php' instead of a traditional static XML file.

<?php
header("Content-Type: application/xhtml xml; charset=UTF-8");
function GetDirArray($folder)
{
    $handle=opendir($folder);
    while ($file=readdir($handle))
    {
        if ($file!="." && $file!="..")
        {
            $ret[count($ret)]=$file;
        }
    }
    closedir($handle);
    sort($ret);
    return $ret;
}
$gallery=GetDirArray('images');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<juiceboxgallery title="Juicebox Gallery">';
for ($i=0; $i<sizeof($gallery); $i++)
{
    echo '<image imageURL="images/'.$gallery[$i].'" thumbURL="images/'.$gallery[$i].'" linkURL="" linkTarget="">';
    echo '<title></title>';
    echo '<caption></caption>';
    echo '</image>';
}
echo '</juiceboxgallery>';
?>

In the above example, all images in a directory named 'images' would be included in the gallery.
You may be able to incorporate Amazon S3 API calls into the code above to fetch your images from Amazon's servers.

Do you have an example of a JuiceBox install with thousands of images?

There are no online examples of such large galleries but it should be very easy to create one yourself using JuiceboxBuilder-Pro. Just drag and drop all your images into the JuiceboxBuilder-Pro interface and save the gallery on the 'Publish' tab.
I have personally created a gallery with over 1000 images in the past and there was no discernible difference between the loading time of this gallery over the loading time of a gallery containing only a few images.

Re: Scalability

Hi,

Juicebox-Pro has no limit on the number of images in a gallery. That said there are a couple of things to think about:

1) In my experience, users get 'click fatigue' viewing a gallery with more that a couple of hundred images. If the user looks at each image in a 1000 image gallery for 5 seconds, it will take over an hour to click through all the images. For this reason we recommend that you split your galleries up into smaller sub-galleries.

2) Larger galleries require a larger XML file to describe all the image data (URLs and captions). Very large galleries will display the preloader for a couple of seconds on load while the XML is loaded and parsed.