[erlang-questions] how: Purging old records from Mnesia table
Thu Mar 6 14:03:29 CET 2008
0.1 - Iterate over the whole table slowly. use
timer:sleep(delay_for_every_read). That's what I would do, since it's
probably the simplest solution.
On Thu, Mar 6, 2008 at 12:38 PM, Gleb Peregud <gleber.p@REDACTED> wrote:
> I would like to implement some algorithm of purging old data from
> mnesia table. Expiration date is written inside each record (could be
> 0 for permanent data).
> I have few ideas how to implement it:
> 0) Every few seconds iterate over whole table and purge old records.
> It is implemented in this way now and it eats about 35% of CPU on
> every purge cycle for about 10 000 entries.
> Will index on expiration field speed up selecting? Is it better to use
> qlc? Will it speed give speed up if i use mnesia:index_match_object()
> 1) Use erlang:send_after() to send messages to purge individual
> records (with special care to timeouts greater then max value of
> unsigned int). Will Erlang runtime handle efficiently potentially up
> to few millions of timers?
> 2) Use some sort of queue to manage sorted list of records to be
> purged. Make special process which will receive information about new
> records, insert into this queue and sleep until first record is to be
> purged. Probably gb_trees will handle it. Are there better ADS for
> this task?
> I'll be greateful for any advices and responses :)
> Best Regards,
> Gleb Peregud
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions