[Java] Swap/Cached Memory

Discussion in 'Bukkit Help' started by Retricide, May 12, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Retricide

    I've been running into some performance issues with my server, recently.

    I have noticed that my server is caching a lot of memory, probably due to MySQL.
    However, the memory is never uncached/unswapped - even if all process (java, mysql, apache) are killed.

    Is this normal? Does cached memory remain cached until a system restart?
    I know memory is cached for efficiency, but it seems almost counterproductive as the cached memory never seems to be used.

    Could anyone help shed some light on this?
    Thanks,
    Eric
     
  2. Offline

    rmb938

    There is a difference between cached memory and swap memory. Linux will cache memory when needed so it is faster to access. If you go over the available ram on your system then it will use swap which is based on the HDD. The cached memory will be used if it is needed as determined by the OS.
     
  3. Offline

    Retricide

    rmb938
    Oh, I see. I never made the distinction, but I get it.

    So, back to my case, my server is caching a lot of memory.
    For example, it cached 5GB of memory (while craftbukkit was running) and did not release it after stopping the minecraft server, java process, and any remaining processes. Is that normal?

    Edit: I know cached memory is usable, but I don't think it's ever being accessed/used after its stores because the cached memory never goes down - it only increases.
     
  4. Offline

    Wendo

    My understanding is that cached memory is simple a report of memory used to cache HDD data. Linux and Windows both try to use free memory to cache HDD data as it improved HDD access. If/when the real memory is required by a program it will drop some of the disk cache from memory and use the memory.

    This is why both OS's show very little free memory at any given time. if you want to see your cached memory go down, load more programs that need to use RAM
     
Thread Status:
Not open for further replies.

Share This Page