I'm strongly considering buying one of the ckFinder Corporate Web Site licenses and I've done a test integration on my Dev server using the ColdFusion version of the demo download.
Everything is working fine, except for one major issue that I have with how Thumbnail images are requested from the server. All of the Thumbnail image request go through the /ckfinder/core/connector/cfm/connector.cfm template. I assume that it is done in a similar fashion in the versions for other server-side languages.
When looking at a folder of 100+ images, this generates 100+ server side requests. I understand that this may be necessary in order to create/update thumbnails that don't exist or are out of date. However, most of our images don't change that often and I suspect that the same is true for most people.
Is this a problem or concern for anyone else? I searched the forums and didn't find any other discussions on the topic.
I would like for ckFinder to use direct URLs to the thumbnail images for as many images as possible and only use the connector for thumbnails that need to be created. I didn't see an existing way to do this. Please let me know if I missed something.
Although I don't like the server-side requests, I do appreciate that those requests add the If-Modified-Since HTTP header, which allows the server to send 304 Not-Modified responses when the thumb has already been cached by the client.
The advantage of the way that it is currently done is that our thumbnail folder doesn't have to be under the webroot. That's not important to me in this case since all of the images have to be under the webroot anyway.
I've spent a little time looking into doing the modification myself, but it looks like I would have to change a significant amount of server-side and javascript code. I want to keep my code as close to standard as possible, so that I can easily upgrade to new versions.
So I guess this is a feature request. Here are some ideas.
Currently ckFinder makes an AJAX request from the server for the folder contents and the response is in the following format.
<?xml version="1.0" encoding="UTF-8"?> <Connector resourceType="Images"><Error number="0"/><CurrentFolder acl="113" path="/" url="/myimagepath/"/> <Files> <File date="200611070000" name="Image1.jpg" size="4"/> <File date="200608030100" name="Image2.gif" size="3"/> <File date="200611020000" name="Image3.jpg" size="3"/> </Files> </Connector>
Re: Thumbnail Requests: Is it possible to request image directly
I'm not sure about this.
The browser shouldn't care if it has directly downloaded the thumbnail or it was sent with a script, all that he cares is about the headers sent along the resource, and it might happen that due to the server configuration, the headers sent by CKFinder are better (and anyway, it shouldn't be worse as you have seen) than those sent with the raw image.
You should try to load a page with several images and when you reload the page, the browser will send requests to the server just in the same way that they are sent for the thumbnails downloaded through a script. So there won't be any extra benefits if I'm right, but it should be tested anyway to be sure that the behaviour is as expected.
Re: Thumbnail Requests: Is it possible to request image directly
You're correct, I was being silly and made a mistake in my post. All of the thumbnail requests would still go into the browser request queue for that hostname and would be handled by the server.
However, the direct requests would be handled strictly by the web server and not by the app server (coldfusion in my case), which is my main goal. At any given time, our Coldfusion servers have plenty of other requests to serve and I would prefer not to add requests for previously generated thumbnails to their processing queues.
Instead of having each thumbnail request check if the thumbnail is available and up-to-date, I'm suggesting putting all of the file system checking into the initial request that returns the XML file listing. The server side connector script would then only need to be called for those images that are not up to date.
Now, let's switch topics back to the browser request queue stuff .....
When I suggested changes to the XML format in my original post, I started to put a CurrentFolder attribute that would hold a comma delimited list of thumbnailurl hostnames (or a set of XML children to hold the same info) for the directly requested thumbnails. The front end JS could then spread the direct request over those hostnames and be able to load more than 2 at a time (without browser addons or changing your FF config). Since they would be direct image requests, there would be less of a concern about making sure that session cookies, etc are sent with the request.
Of course, there are downsides such as the likelihood of having multiple versions of the same thumbnail image in browser cache because different hostnames were used to call it on successive loads of the folder. Anyway, I left that stuff out of my earlier post since that is not my main concern. It would be like icing on the cake. Plus since FF3 and IE8 are increasing the connection limit per hostname, the benefits of such tricks may be outweighed by the detriments.
Re: Thumbnail Requests: Is it possible to request image directly
Regarding:
I think this could be solved by assigning each user to a specific (random) server per session (or forever), so instead of sending list of thumbnailurl hostnames, send only one, selected server.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Thumbnail Requests: Is it possible to request image directly
As you probably know, Coldfusion MX7 is set to handle a certain number of simultaneous requests (usually like 6-8 per processor -- but don't quote me) and if that limit is reached other requests queue up and wait their turn. I believe other some other server-side platforms operate in a similar manner. By making direct calls for thumbnail images, those request would completely bypass the server-side processing queue ... which would be a good thing to me.
Now, on to your point about assigning users to a single hostname ...
In order to get around the browser's connection limit per hostname, thumbnail requests for each user would have to come from multiple hostnames. For example, if the user's browser was limited to 2 connections per hostname (like the vast majority of users), they would only be able to load two thumbnails at a time if all of image requests were sent to a single hostname. But if we were spreading requests for that user across 4 hostnames, then the user would be able to request 8 thumbnails at a time.
You can get around the caching problem by figuring out a way to consistently assign the same hostname to a particular image for every request. If the hostnames were loaded into an array, you could do something like (length of the thumbnail filename) mod (length of array) and then use the result of that as the array position for the selected hostname for that image. Such a method could consistenly return the same hostname for each image. Of course, the set of images would probably not be equally spread across the hostnames, but it would still give you the benefit of having multiple queues.
Re: Thumbnail Requests: Is it possible to request image directly
Yes, my response might not have leave it clear, but the obvious benefit of your idea is that the app server isn't used to serve static content, so it can give a performance improvement at the server side.
Your idea about splitting the request across several domain names is something to think about, but I have a feeling that this is something more specific, it won't work properly most of the times so we could focus just on how to use static content wherever it is possible and not get distracted by something that it's far more complex.
Re: Thumbnail Requests: Is it possible to request image directly
I agree, the idea of spreading the static content request across multiple hostnames is more complex and probably not nearly as important.
That being said, where do we go from here? Is there something that I can do to help turn the idea of directly requesting static thumbnails into reality?
Re: Thumbnail Requests: Is it possible to request image directly
Thanks acterry for your feedback!
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+