# File System Cache Vs JVM

**URL:** <https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057>\
**Category:** Elasticsearch\
**Created:** [July 5, 2019, 9:25am UTC](https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057 "2019-07-05T09:25:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitmjadav](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@amitmjadav](https://discuss.elastic.co/u/amitmjadav)\
**Post date:** [July 5, 2019, 9:25am UTC](https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057/1 "2019-07-05T09:25:49Z")

</div>

Hi,

Can anyone explain me the difference between File System Cache and JVM Memory and how it affects in searching speed performance ??

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 5, 2019, 9:39am UTC](https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057/2 "2019-07-05T09:39:27Z")

</div>

When an OS needs to read some data from disk, if the same data is read multiple times, the OS will most likely put in its RAM the file that you read.  
Next time, access to this file will be faster.

In Elasticsearch we are using Lucene behind the scene. Lucene writes immutable files on disk called segments.  
Once you searched in a segment (read from disk), the OS will use the mechanism I described and will basically put the segment in RAM automatically. So the next time you will search on this segment, it will be much faster than the first time.

---

<div class="post-metadata">

**Author:** ![amitmjadav](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@amitmjadav](https://discuss.elastic.co/u/amitmjadav)\
**Post date:** [July 5, 2019, 11:53am UTC](https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057/3 "2019-07-05T11:53:34Z")

</div>

Thanks for reply.

but see my scenario .. I have 32GB of RAM and have given 28GB as JVM Memory ... So is it require to give Additional Page file if I am using Windows OS. ??? I am giving Page size as different partition of 50GB ......

So can you suggest me the best practice configuration so that it will not hamper my searching performance...

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 5, 2019, 3:51pm UTC](https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057/4 "2019-07-05T15:51:28Z")

</div>

As written in documentation, never use swap. Assign only half of the available RAM to the HEAP.

---

<div class="post-metadata">

**Author:** ![amitmjadav](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@amitmjadav](https://discuss.elastic.co/u/amitmjadav)\
**Post date:** [July 6, 2019, 4:38pm UTC](https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057/5 "2019-07-06T16:38:13Z")

</div>

Ok.. So its not good practice to use page size in Windows OS and Swap in Linux... Right ?? Let me correct if I am wrong ....

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 6, 2019, 4:47pm UTC](https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057/6 "2019-07-06T16:47:40Z")

</div>

Using swapping to disk is bad practice andstrongly recommended against.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 3, 2019, 4:55pm UTC](https://discuss.elastic.co/t/file-system-cache-vs-jvm/189057/7 "2019-08-03T16:55:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
