How to disable swap space entry for a process (Sticky bit?)
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to disable swap space entry for a process (Sticky bit?)
Hi,
I have a RH9 system with 1G of RAM. I start a server process that will initialize by allocating a data structure that's about 500Mb in size. The problem is that as the process initializes itself, the data structure is allocated in swap space rather than in RAM. It's only when the data structure is actually used during computation that it seems to enter RAM from swap. As a consequence, the first time the data structure is instanced, the server takes about 180 seconds to process the request.
From then on it takes less than a second as it should. I also notice that the process size is constant at 437Mb from the start, but the resident size (RSS) in top is 217Mb before the first request, and stays constant at 437Mb after the first request. I do know that there is no demand for RAM when this process is started (i.e. this is the only RAM-hungry process when it starts up). So how do I make it NOT ENTER swap space at all, from the moment it starts? I don't want users to have to wait 180 seconds for their first request.
Thanks much.
pandamatak
PS. Every byte of the entire data structure is accessed for each server request.
Re: How to disable swap space entry for a process (Sticky bit?)
Quote:
Originally posted by Pandamatak Hi,
I don't want users to have to wait 180 seconds for their first request.
3 minute wait , hmm.............you can't just turn the swap on/off any time you want.............try this tho, edit your /etc/fstab and comment out the "swap" line and re-boot, with no swap at all things might run faster when memory is always utilized...............just have to try it and see what happens?!?!?!
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Just access whole of the data at startup time, this will move it from the swap to RAM. Then your first request will run fast.
If you want that area to stay on RAM forever, you can use the mlock call to have it staying there.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.