[erlang-questions] Guidance to a cache mechanism

Tim Watson <>
Tue Oct 30 16:29:29 CET 2012


Hi all

On 30 Oct 2012, at 15:14, Paul Peregud wrote:

> Guarding writes to cache using gen_server is ok. You may leave want to
> make ets table public and use {read_concurrency, true}.
> 

This *can* be helpful, but individual ets tables used from lots of processes can also become a bottleneck and start throttling the schedulers. Manually breaking up your ets tables into smaller chunks sometimes helps, but can add a lot of complexity to the design too.

> [snip]
> 
> On Tue, Oct 30, 2012 at 1:01 PM, Rapsey <> wrote:
>> Do not use timer module. Use erlang:send_after/3
>> In my experience the timer module is unreliable and send_after will always
>> work.
>> 

Whilst this is true, you should be aware that for very long timeouts, erlang:send_after/3 explodes if millis is > 2^32-1. If your timeouts are never that long (which they probably aren't) then it's not an issue, but worth baring in mind if you're planning on caching things for days at a time.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121030/4a4bfd26/attachment.bin>


More information about the erlang-questions mailing list