c# - How to Cache a large amount of data from database for ASP.NET Mvc -
my website uses linq-to-sql load 50k rows of data database. data static , never changes. works similar spam filter , 50k rows of patterns need loaded.
what's best way program this? optimal performance?
loading entire thing single static readonly data-structure (it being immutable means once constructed can safely used many threads) give greatest overall performance per lookup.
however, lead long start-up time, may not acceptable. in case may consider loading each item accessed, brings concurrency issues (since mutating data-structure used multiple threads).
in between option of loading indices on start-up, , adding rest of information on per-access basis, finer-grained locks reduce lock contention.
or can ignore lot , load database needed. have advantages in terms of performance because memory not used rarely-used information. it'll whole lot easier if ever find have allow data change.
no 1 comes out reasonable way go in general, it'll depend on specifics of application, data, , usage patterns.
Comments
Post a Comment