Does the Linux filesystem cache files efficiently?

前端 未结 5 2031
悲&欢浪女
悲&欢浪女 2020-12-25 13:08

I\'m creating a web application running on a Linux server. The application is constantly accessing a 250K file - it loads it in memory, reads it and sends back some info to

5条回答
  •  时光说笑
    2020-12-25 13:36

    As people have mentioned, mmap is a good solution here.

    But, one 250k file is very small. You might want to read it in and put it in some sort of memory structure that matches what you want to send back to the user on startup. Ie, if it is a text file an array of lines might be a good choice, etc.

提交回复
热议问题