Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 590083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:29:29+00:00 2026-05-13T15:29:29+00:00

I am using mysql as a db. Is there any formula for determining the

  • 0

I am using mysql as a db.

Is there any formula for determining the cache size needed to cache the results?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:29:30+00:00Added an answer on May 13, 2026 at 3:29 pm

    This is usually a function of how much spare RAM you have, the size of your database, and how much of the dataset is “popular”.

    (Below is assuming that you are talking about an application-level cache, and not I/O caches, buffer caches, or other lower-level caching.)

    If you’re sizing your cache for performance (i.e., maximize throughput, and minimize latency), then one simple formula would be to use as much as your spare RAM as possible that is less than your total database size. Another simple formula would be to start somewhere between 1% and 10% of your database size, and grow based on usage.

    If you want to carefully calculate how much cache you need, then the most reliable way to do it is by experimentation, i.e., run load-tests against growing cache-sizes and graph the hit-rate (This is especially true if your database load/usage characteristics are complicated.)

    For example, you can have a graph where the X-axis is the cache-size, and the Y-axis has both hit-rate and query-latency. Your goal would be to find the minimum X (cache-size) where hit-rate is maximized and query-latency is minimized (these could be different points).

    In order to do this correctly, you need a real-world load test i.e., if you keep logs of your queries, you can replay them. You may want to limit your replay of only non-mutating queries only (for simplicity).

    Note that instead of loadtests, you can simplify this process by adding a cache (start somewhere between 1% and 10%) to a live database, then watching the hit-rate and query-latency over time. This is a bit easier to do if you don’t have a load-test framework setup, but may be more intrusive on a production system. If the hit-rate is too low (or query-latency too high), then grow the cache. If not, then see if shrinking it makes a noticeable difference.

    (Of course, there are edge cases here, which I’m glossing over, but this is the general idea. E.g., sometimes different types of queries can have different costs, and you may need to allocate different caches for different query types.)

    Once you do have a cache, you should monitor it’s statistics along with other query stats, such as latency. You may need to grow it over time.

    Or, you may find that you need to warm the cache up before you can get any reliable performance. For example, if you rely on your cache to be able to serve out a specific query-load, and your caching component crashes, starting up cold, then your database will get overloaded for some period of time while the cache warms up.

    Anyhow, the short answer is that there is no simple solution, and sizing your cache best done by experimentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.