Hello!
On Thu, May 31, 2012 at 5:15 PM, Sparsh Gupta <
spars...@gmail.com> wrote:
> Awesome, I will post some benchmarking results once we have it. Looking forward
>
Nice! Looking forward to your results :)
> I have 2 follow up questions:
> 1. Is there any best practices document while using ngx.shared.DICT in
> a lua code? (e.g. recommended size of cache, how efficiency of cache
> changes with size of cache, etc)
>
It mainly depends on concrete scenarios and how much resources you
have on your machine :) Basically, the larger the size of the cache,
the higher the cache hit rate will be.
> 2. We primarily rely on 2 types of cache keys for serving our content.
> One of the keys almost always fetch data below 500bytes (But have many
> hundred thousands of such keys if not millions) and the other key
> fetch data around 5-10Kb (Usually around 10,000 keys). Will there be
> any difference in the following two scenerios (we will test them but
> logically what do you think)
>
> 2.1 if we use a common DICT for both the keys
> 2.2. If we use a separate DICT (DICT1, DICT2) for the two types of
> keys. If we adapt this, can we tune the cache in a way that it
> utilizes the key-value size information for faster performance?
>
Option 2.2, i.e., using separate DICTs, should be better.
Using separate dictionaries can always reduce the over-all locking
effects (there is a global lock in each shared dict).
Memory fragmentation is also much less likely when the size of the
values in the single DICT do not vary much.
Hope this helps,
-agentzh