You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Daniel Morilha <dm...@gmail.com> on 2015/09/28 20:20:41 UTC

persist specific requests only in RAM cache

Hi,

I would like to know if ats provides any way to trick the cache and store
some specific request only in RAM so when ats restarts the entry won't be
there any longer.

Thanks,

-- 
Daniel Morilha (dmorilha@gmail.com)

Re: persist specific requests only in RAM cache

Posted by Sudheer Vinukonda <su...@yahoo-inc.com>.
FWIW, I use separate cache volumes to store playlist files and segment files, by modifying the cache key to include different hostnames for each kind of file. It does work well :)

Here's a sample config:

hosting.config:

hostname=blahblah.com volume=1
hostname=* volume=2,3,4


In my plugin, I set the cache key for playlist files (identified with file extension .m3u8), as blahblah.com/....

This makes all the playlist files go to volume 1, while the rest go to other volumes.

For the original question that Daniel asked though, it should still work to create a ramdisk based volume and modifying cache key to point to that volume etc, but, I think a lot simpler approach would be to use a dynamic cache key with a query param that's unique per restart (e.g. timestamp).


Thanks,

Sudheer






On Monday, September 28, 2015 1:53 PM, Phil Sorber <so...@apache.org> wrote:



On Mon, Sep 28, 2015 at 2:48 PM Jeremy Payne <jp...@gmail.com> wrote:

i am going to test this tonight, but are you saying that it's possible to split the cache based on some transaction condition?
>
>
>meaning the below would be stored in ramdisk.
>
>
>http://media.domain.com/chunk.ts
>
>
>while the below would be stored in a generic(disk) volume.
>
>
>http://media.domain.com/image.gif
>
>
>again, i have yet to test, but i believe this is all driven by setting the cache key to use the domain which is mapped to the ramdisk volume.
>
>if this sounds right to you, then it means i am on the right path.
>
>
>
>

I know for sure you can specify what volume you want something to land on. Not sure if setting the cache key will do this for you though. Worth a shot.

Also, I think was Leif was suggesting was that you turn the ram cache off in favor of a ram drive, but that will have the side effect of turning ram cache off for your non-volatile storage as well which I do not think you want.
 

>
>
>
>
>
>On Mon, Sep 28, 2015 at 3:26 PM, Leif Hedstrom <zw...@apache.org> wrote:
>
>
>>
>>On Sep 28, 2015, at 12:37 PM, Jeremy Payne <jp...@gmail.com> wrote:
>>>
>>>not sure if this answers your question, but i have been thinking about something similar.
>>>
>>>this is how i have it played out in my mind, although i havent looked at the transaction points to see when host/domain is considered for volume placement.
>>>
>>>1. create a ramdisk(or some memory based filesyetm)
>>>2. map the ramdisk to store content for some domain 
>>>
>>
>>
>>
>>This ought to work, however, be aware that if you have ATS configured with a RAM cache, you will store such objects in RAM twice. If you do this, odds are that you are best off turning off RAM cache entirely in ATS itself (but, I’ve never done that, so not sure how the performance will be). 
>>
>>
>>— Leif
>>
>>
>>3. write a lua script to change the cache key of specific requests to something within the ramdisk domain
>>>4. the expectation is that with this change, the desired objects will be found in the ramdisk volume. 
>>>
>>>
>>>
>>>
>>>
>>>On Mon, Sep 28, 2015 at 1:20 PM, Daniel Morilha <dm...@gmail.com> wrote:
>>>
>>>Hi,
>>>>
>>>>
>>>>I would like to know if ats provides any way to trick the cache and store some specific request only in RAM so when ats restarts the entry won't be there any longer.
>>>>
>>>>
>>>>Thanks,
>>>>
>>>>-- 
>>>>
>>>>Daniel Morilha (dmorilha@gmail.com)
>>>
>>
>

Re: persist specific requests only in RAM cache

Posted by Leif Hedstrom <zw...@apache.org>.
> On Sep 28, 2015, at 2:53 PM, Phil Sorber <so...@apache.org> wrote:
> 
> On Mon, Sep 28, 2015 at 2:48 PM Jeremy Payne <jp557198@gmail.com <ma...@gmail.com>> wrote:
> i am going to test this tonight, but are you saying that it's possible to split the cache based on some transaction condition?
> 
> meaning the below would be stored in ramdisk.
> 
> http://media.domain.com/chunk.ts <http://media.domain.com/chunk.ts>
> 
> while the below would be stored in a generic(disk) volume.
> 
> http://media.domain.com/image.gif <http://media.domain.com/image.gif>
> 
> again, i have yet to test, but i believe this is all driven by setting the cache key to use the domain which is mapped to the ramdisk volume.
> if this sounds right to you, then it means i am on the right path.
> 
> 
> 
> I know for sure you can specify what volume you want something to land on. Not sure if setting the cache key will do this for you though. Worth a shot.
> 
> Also, I think was Leif was suggesting was that you turn the ram cache off in favor of a ram drive, but that will have the side effect of turning ram cache off for your non-volatile storage as well which I do not think you want.


Right, it depends on what the non-volatile disks are, and what percentage of traffic goes on them. If they are SSDs, odds are that they can do just fine without RAM backing.

Another option that might be more attractive is to look at e.g. bcache (https://en.wikipedia.org/wiki/Bcache <https://en.wikipedia.org/wiki/Bcache>).

— leif


Re: persist specific requests only in RAM cache

Posted by Jeremy Payne <jp...@gmail.com>.
great.. i am going to test this tonight to see where in the transaction i
can influence the volume placement decision.



On Mon, Sep 28, 2015 at 3:53 PM, Phil Sorber <so...@apache.org> wrote:

> On Mon, Sep 28, 2015 at 2:48 PM Jeremy Payne <jp...@gmail.com> wrote:
>
>> i am going to test this tonight, but are you saying that it's possible to
>> split the cache based on some transaction condition?
>>
>> meaning the below would be stored in ramdisk.
>>
>> http://media.domain.com/chunk.ts
>>
>> while the below would be stored in a generic(disk) volume.
>>
>> http://media.domain.com/image.gif
>>
>> again, i have yet to test, but i believe this is all driven by setting
>> the cache key to use the domain which is mapped to the ramdisk volume.
>> if this sounds right to you, then it means i am on the right path.
>>
>>
>>
> I know for sure you can specify what volume you want something to land on.
> Not sure if setting the cache key will do this for you though. Worth a shot.
>
> Also, I think was Leif was suggesting was that you turn the ram cache off
> in favor of a ram drive, but that will have the side effect of turning ram
> cache off for your non-volatile storage as well which I do not think you
> want.
>
>
>>
>>
>>
>> On Mon, Sep 28, 2015 at 3:26 PM, Leif Hedstrom <zw...@apache.org> wrote:
>>
>>>
>>> On Sep 28, 2015, at 12:37 PM, Jeremy Payne <jp...@gmail.com> wrote:
>>>
>>> not sure if this answers your question, but i have been thinking about
>>> something similar.
>>>
>>> this is how i have it played out in my mind, although i havent looked at
>>> the transaction points to see when host/domain is considered for volume
>>> placement.
>>>
>>> 1. create a ramdisk(or some memory based filesyetm)
>>> 2. map the ramdisk to store content for some domain
>>>
>>>
>>>
>>> This ought to work, however, be aware that if you have ATS configured
>>> with a RAM cache, you will store such objects in RAM twice. If you do this,
>>> odds are that you are best off turning off RAM cache entirely in ATS itself
>>> (but, I’ve never done that, so not sure how the performance will be).
>>>
>>> — Leif
>>>
>>> 3. write a lua script to change the cache key of specific requests to
>>> something within the ramdisk domain
>>> 4. the expectation is that with this change, the desired objects will be
>>> found in the ramdisk volume.
>>>
>>>
>>>
>>> On Mon, Sep 28, 2015 at 1:20 PM, Daniel Morilha <dm...@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I would like to know if ats provides any way to trick the cache and
>>>> store some specific request only in RAM so when ats restarts the entry
>>>> won't be there any longer.
>>>>
>>>> Thanks,
>>>>
>>>> --
>>>> Daniel Morilha (dmorilha@gmail.com)
>>>>
>>>
>>>
>>>
>>

Re: persist specific requests only in RAM cache

Posted by Phil Sorber <so...@apache.org>.
On Mon, Sep 28, 2015 at 2:48 PM Jeremy Payne <jp...@gmail.com> wrote:

> i am going to test this tonight, but are you saying that it's possible to
> split the cache based on some transaction condition?
>
> meaning the below would be stored in ramdisk.
>
> http://media.domain.com/chunk.ts
>
> while the below would be stored in a generic(disk) volume.
>
> http://media.domain.com/image.gif
>
> again, i have yet to test, but i believe this is all driven by setting the
> cache key to use the domain which is mapped to the ramdisk volume.
> if this sounds right to you, then it means i am on the right path.
>
>
>
I know for sure you can specify what volume you want something to land on.
Not sure if setting the cache key will do this for you though. Worth a shot.

Also, I think was Leif was suggesting was that you turn the ram cache off
in favor of a ram drive, but that will have the side effect of turning ram
cache off for your non-volatile storage as well which I do not think you
want.


>
>
>
> On Mon, Sep 28, 2015 at 3:26 PM, Leif Hedstrom <zw...@apache.org> wrote:
>
>>
>> On Sep 28, 2015, at 12:37 PM, Jeremy Payne <jp...@gmail.com> wrote:
>>
>> not sure if this answers your question, but i have been thinking about
>> something similar.
>>
>> this is how i have it played out in my mind, although i havent looked at
>> the transaction points to see when host/domain is considered for volume
>> placement.
>>
>> 1. create a ramdisk(or some memory based filesyetm)
>> 2. map the ramdisk to store content for some domain
>>
>>
>>
>> This ought to work, however, be aware that if you have ATS configured
>> with a RAM cache, you will store such objects in RAM twice. If you do this,
>> odds are that you are best off turning off RAM cache entirely in ATS itself
>> (but, I’ve never done that, so not sure how the performance will be).
>>
>> — Leif
>>
>> 3. write a lua script to change the cache key of specific requests to
>> something within the ramdisk domain
>> 4. the expectation is that with this change, the desired objects will be
>> found in the ramdisk volume.
>>
>>
>>
>> On Mon, Sep 28, 2015 at 1:20 PM, Daniel Morilha <dm...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I would like to know if ats provides any way to trick the cache and
>>> store some specific request only in RAM so when ats restarts the entry
>>> won't be there any longer.
>>>
>>> Thanks,
>>>
>>> --
>>> Daniel Morilha (dmorilha@gmail.com)
>>>
>>
>>
>>
>

Re: persist specific requests only in RAM cache

Posted by Jeremy Payne <jp...@gmail.com>.
i am going to test this tonight, but are you saying that it's possible to
split the cache based on some transaction condition?

meaning the below would be stored in ramdisk.

http://media.domain.com/chunk.ts

while the below would be stored in a generic(disk) volume.

http://media.domain.com/image.gif

again, i have yet to test, but i believe this is all driven by setting the
cache key to use the domain which is mapped to the ramdisk volume.
if this sounds right to you, then it means i am on the right path.





On Mon, Sep 28, 2015 at 3:26 PM, Leif Hedstrom <zw...@apache.org> wrote:

>
> On Sep 28, 2015, at 12:37 PM, Jeremy Payne <jp...@gmail.com> wrote:
>
> not sure if this answers your question, but i have been thinking about
> something similar.
>
> this is how i have it played out in my mind, although i havent looked at
> the transaction points to see when host/domain is considered for volume
> placement.
>
> 1. create a ramdisk(or some memory based filesyetm)
> 2. map the ramdisk to store content for some domain
>
>
>
> This ought to work, however, be aware that if you have ATS configured with
> a RAM cache, you will store such objects in RAM twice. If you do this, odds
> are that you are best off turning off RAM cache entirely in ATS itself
> (but, I’ve never done that, so not sure how the performance will be).
>
> — Leif
>
> 3. write a lua script to change the cache key of specific requests to
> something within the ramdisk domain
> 4. the expectation is that with this change, the desired objects will be
> found in the ramdisk volume.
>
>
>
> On Mon, Sep 28, 2015 at 1:20 PM, Daniel Morilha <dm...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I would like to know if ats provides any way to trick the cache and store
>> some specific request only in RAM so when ats restarts the entry won't be
>> there any longer.
>>
>> Thanks,
>>
>> --
>> Daniel Morilha (dmorilha@gmail.com)
>>
>
>
>

Re: persist specific requests only in RAM cache

Posted by Leif Hedstrom <zw...@apache.org>.
> On Sep 28, 2015, at 12:37 PM, Jeremy Payne <jp...@gmail.com> wrote:
> 
> not sure if this answers your question, but i have been thinking about something similar.
> 
> this is how i have it played out in my mind, although i havent looked at the transaction points to see when host/domain is considered for volume placement.
> 
> 1. create a ramdisk(or some memory based filesyetm)
> 2. map the ramdisk to store content for some domain 


This ought to work, however, be aware that if you have ATS configured with a RAM cache, you will store such objects in RAM twice. If you do this, odds are that you are best off turning off RAM cache entirely in ATS itself (but, I’ve never done that, so not sure how the performance will be). 

— Leif

> 3. write a lua script to change the cache key of specific requests to something within the ramdisk domain
> 4. the expectation is that with this change, the desired objects will be found in the ramdisk volume. 
> 
> 
> 
> On Mon, Sep 28, 2015 at 1:20 PM, Daniel Morilha <dmorilha@gmail.com <ma...@gmail.com>> wrote:
> Hi,
> 
> I would like to know if ats provides any way to trick the cache and store some specific request only in RAM so when ats restarts the entry won't be there any longer.
> 
> Thanks,
> 
> -- 
> Daniel Morilha (dmorilha@gmail.com <ma...@gmail.com>)
> 


Re: persist specific requests only in RAM cache

Posted by Jeremy Payne <jp...@gmail.com>.
not sure if this answers your question, but i have been thinking about
something similar.

this is how i have it played out in my mind, although i havent looked at
the transaction points to see when host/domain is considered for volume
placement.

1. create a ramdisk(or some memory based filesyetm)
2. map the ramdisk to store content for some domain
3. write a lua script to change the cache key of specific requests to
something within the ramdisk domain
4. the expectation is that with this change, the desired objects will be
found in the ramdisk volume.



On Mon, Sep 28, 2015 at 1:20 PM, Daniel Morilha <dm...@gmail.com> wrote:

> Hi,
>
> I would like to know if ats provides any way to trick the cache and store
> some specific request only in RAM so when ats restarts the entry won't be
> there any longer.
>
> Thanks,
>
> --
> Daniel Morilha (dmorilha@gmail.com)
>

Re: persist specific requests only in RAM cache

Posted by Sudheer Vinukonda <su...@yahoo-inc.com>.
I'm not sure if there's a way to store an object in RAM cache alone (unless, you are using a ramdisk to fake the disk).
As far as *caching* an object in a sort of non-persistent manner, one trick that comes to my mind is to use a dynamic cache key (e.g a query parameter which includes the restart time, at ATS restart).
Thanks,
Sudheer 


     On Monday, September 28, 2015 11:21 AM, Daniel Morilha <dm...@gmail.com> wrote:
   

 Hi,
I would like to know if ats provides any way to trick the cache and store some specific request only in RAM so when ats restarts the entry won't be there any longer.
Thanks,
-- 
Daniel Morilha (dmorilha@gmail.com)