> If you intended to do parent proxy across colos (I'm guessing?),
you'd want to use the TSHttpTxnParentProxySet() AP in a plugin.
Again, please excuse my ignorance.
I couldn't find a way to get all the information I (think I) need in the
plugin context? I use the TS_HTTP_OS_DNS_HOOK and can set the parent to
use, but, I would like the use the list of parents and their status as
available in proxy/ParentSelection.cc... I think in that context it
would also be easier to keep a consistent hash of the available parents
using the callback functions.
It's easy to add a "urlhash" scheme to the existing parent selection
scheme with something like:
diff -w proxy/ParentSelection.cc
../org/trafficserver-3.0.2/proxy/ParentSelection.cc
496,497d495
< char *url_p, *end_p;
< int simple_int_hash;
522,541d519
< case P_HASH_URL:
< url_p = rdata->get_string();
< if (url_p == NULL) {
< url_p = xstrdup("");
< }
< // The upto ".ism/" is a total hack for our URLs, need to
make that a parameter
< end_p = strstr(url_p, ".ism/");
< if (*end_p == NULL) {
< end_p = url_p + strlen(url_p) -1;
< }
< TSDebug("parent_select", "url_p:%p end_p:%p", url_p, end_p);
< simple_int_hash = 0;
< // And yes... This should be a fancy consistent hash
< while (url_p < end_p && *url_p != '\0' && (url_p < url_p +
64)) {
< simple_int_hash += *url_p;
< url_p++;
< }
< cur_index = simple_int_hash % num_parents;
< TSDebug("parent_select", "h:%d index:%d", simple_int_hash,
cur_index);
< break;
783,784d760
< } else if (strcasecmp(val, "urlhash") == 0) {
< round_robin = P_HASH_URL;
diff -w proxy/ParentSelection.h
../org/trafficserver-3.0.2/proxy/ParentSelection.h
172,173c172
< P_HASH_ROUND_ROBIN,
< P_HASH_URL
---
> P_HASH_ROUND_ROBIN
which illustrates what I want to do... Can I do something similar in the
plugin context? Should it be done it in the plugin context?
Thanks again,
JvD
On 03/13/2012 02:07 PM, Leif Hedstrom wrote:
> On 3/13/12 1:37 PM, Van Doorn, Jan R wrote:
>> Hello,
>>
>> I apologize if this has been discussed before, or is in the
>> documentation. I am fairly new to ATS, so forgive my ignorance.
>>
>> I am looking at building a multi tier CDN, and want to have "content
>> affinity" when my edge caches miss and select a parent cache, meaning, I
>> want to have multiple caches in the same parent caching location, and I
>> don't want to have these caches store the same content.
>>
>> I know I could use ICP to share the caches in a location, but the
>> records.config says "ICP Configuration. NOTE! ICP is currently broken
>> NOTE!", and I am hesitant to use ICP, as it seems to bring a lot of
>> complexity.
>
> Hmmm, ICP wouldn't solve this would it? ICP is generally a multi-cast
> protocol, intended to be used from within the colocation. It also
> duplicates the cache across all peers of an ICP network. ICP is
> similar to the clustering feature that ATS, which is one reason why no
> one has bothered with getting ICP to work.
>
> If you intended to do parent proxy across colos (I'm guessing?), you'd
> want to use the TSHttpTxnParentProxySet() AP in a plugin. Or, if you
> can partition your parent proxies based on various "rules" on the URL
> (e.g. a prefix of a path), you can use our parent.config to pick and
> choose parent(s) for various URLs (but it's a manually maintained
> config, obviously).
>
> If really what you are asking is for a distributed cache within the
> colo where each object is on one single cache, then take a look at the
> clustering feature. It uses URL hashes. It wouldn't work well across
> colocations though.
>
> -- Leif
>