50GB HttpRuntime.Cache Persistence Possible?

前端 未结 1 2093
猫巷女王i
猫巷女王i 2021-02-11 06:27

We have an ASP.NET 4.0 application that draws from a database a complex data structure that takes over 12 hours to push into an in memory data structure (that is later stored in

1条回答
  •  别那么骄傲
    2021-02-11 07:02

    In memory databases such as memcache or Redis are slow in comparison to HttpRuntime.Cache

    Yes, but they are very fast compared to a 12+ hour spin-up. Personally, I think you're taking the wrong approach here in forcing load of a 50 GB structure. Just a suggestion, but we use HttpRuntime.Cache as part of a multi-tier caching strategy:

    • local cache is checked etc first
    • otherwise redis is used as the next tier of cache (which is faster than the underlying data, persistent, and supports a number of app servers) (then local cache is updated)
    • otherwise, the underlying database is hit (and then both redis and local cache are updated)

    The point being, at load we don't require anything in memory - it is filled as it is needed, and from then on it is fast. We also use pub/sub (again courtesy of redis) to ensure cache invalidation is prompt. The net result: it is fast enough when cold, and very fast when warm.

    Basically, I would look at anything that avoids needing the 50GB data before you can do anything.


    If this data isn't really cache, but is your data, I would look at serialization on a proper object model. I would suggest protobuf-net (I'm biased as the author) as a strong candidate here - very fast and very small output.

    0 讨论(0)
提交回复
热议问题