In my quest for the most efficient server environment that I can create I have spent a good portion of my life drilling down to the lowest levels of the linux kernel. This helps to me better understand how to make use of and in some cases limit cpu and I/O usage to make the server perform well. One very important aspect of server performance is virtual memory.
Virtual memory is memory is that stored on a disk of some sort that acts as main system memory. So if your machine has 16 gigs of memory, and you have 16 gigs of swap space (virtual memory), then your server can operate as if it has 32 gigs of main system memory. Virtual memory/swap space has been used for decades as a way for machines to accomplish more than what they were originally built to handle, and for the most part its worked well. The problem is that it is SLOW. A traditional spindle/platter based disk has access times (Think flipping through a phone book to look up a name) that is anywhere from 700x to 2500x slower than normal system memory. Thats a problem if you have a server that uses swap a lot.
There is a lot more to the swap debate than what I mention above, and there are many articles written that could explain its benefits and detriments much better than I ever could. I am writing about swap today to outline some changes that I think would greatly benefit how swap works in a multiuser environment (Shared hosting).
Since swap capabilities have generally not changed in 25 years it would be nice if someone could take a 2nd look at the feature set and update with features to benefit todays users. Here are a few of my proposals.
1) Ability to swap based on a specific uid or gid (user id, or group id). On a shared user platform some users dominate the memory usage. While you can control memory usage for a certain user you can’t control the swappiness of certain users. It would be great for “greedy” memory users to still be able to use swap, but have those specific users also endure the speed penalties that increased memory usage requires. This would be GREAT to have!
2) Ability to swap by pid/tid (Process ID, and thread ID) – Some programs lend themselves to swapping while other don’t. If I could specify certain apps to swap more aggressively than others I could fine tune the system to work better. I know better than the kernel the performance I need from each application. Let me use that knowledge to tweak virtual memory usage by pid/tid.
3) Ability to NOT swap by pid/tid – Just as I stated above that I need to be able to increase the swappiness of certain applications, I also need the ability to exclude certain apps from swapping unless it is absolutely necessary. MySQL is a good example of this. I don’t want it swapping at all. Not even a little bit. I sure wish I could turn it off for this app!
4) Time based reporting for swap usage. Everyone knows that swap usage is slow, but HOW SLOW? What is the average time in milliseconds to swap out and swap in memory for the app you are using? How many milliseconds per page in the last 1,5,15,30 seconds etc. How overloaded or underloaded is the swap device? Are the seeks killing the swap device? Time to switch to an SSD for swap? How many pages are being swapped out or in for a specific app or uid.
5) Swap priorities for devices based on performance. You can specify multiple swap partitions/files if you like currently. However you have to set the priority for those devices when swap is activated. Swap out and swap in functions should be able to be set based on response time of swap devices. If a single swap device is getting crushed, but you have multiple devices why not use the other one to mitigate the slowness of the first swap device. This is NOT as simple as round robin type load balancing of swap devices. It needs to be intelligent and use devices based on response time in milliseconds. It should also be able to split pages for specific apps across multiple swap devices (If you desire) so that swap in is faster (Similar to raid 5 setup).
Swap algorithms are too simple for a time that is long gone in todays computing environment. Get rid of all the global settings, and give us some fine tuned options to make swap perform at the level we need it to be. If there are any coding Santa Clauses out there please put an updated virtual memory manager in my virtual stocking!
If you think I am wrong on these swap issues please send your replies to “to_be_deleted@bluehost.com”
Thanks,
Matt Heaton / President Bluehost.com
10 Responses to “Virtual Memory – The Swap Problem”
Be ready to waste alot of time and energy. The servers and email are both a joke. The website administration is a joke, and it’s probably you will see extended e mail outages due to the fact that there internet hosting policies are stored on weakly collateralled shared servers. Stay away from Without exceptions!
Prepare yourself to spend a lot of time and energy. The computers and e mail are each bull crap. The domain administration is a joke, and it’s most likely you will observe long electronic mail outages because that there hosting strategies are housed on weakly collateralled shared computers. Keep away from Without exceptions!
Certainly the top web hosting service I have ever before chosen. It is really instant, reliable, user friendly and inexpensive. When there exists problems, support service is definitely responsive and respectful. What else could you prefer?
Undoubtedly the best web host service I have actually chosen. Its fast, well-performing, user friendly and low-priced. If there is a problem, customer support is reactive and affable. Just what exactly else would you wish?
Thanks for making the effort to share this with us, just loved it.
Found myselfself here in search of some thing totally else, but turned out to be an interesting read anyway, so I guess sometimes it’s ok that you can’t use a search engine properly.
Great to finally see somebody who are able to do a correct blogpost without spelling errors or lousy grammar.
Outsourcing site that has more than just the normal government projects listed. Looks good.
I want to say – thank you for this!
Godaddy.com coupon code list. Vast quantities of the older Godaddy.com coupons have changed. Here’s the official promo codes that are just released. These coupons will work thru 2011. .COM Domain Names or Manual Renewals for just $7.49 – Use Go Daddy coupon codes GOO3, OK9, or ZINE10. 25% discount on orders of $100+ – Use Godaddy coupon OK25. 30% Discount when you buy any com domain – Use Go Daddy coupon code OK30. $12.99 SSL Certificates – Use Go Daddy coupon codes GOOSSL, OKSSL, or ZINESSL. Host Plan Promo Code – 20% Hosting Discount – Use Go Daddy coupon codes OK20H, ZINE20H1 or GOO20H. 10% off any size order – Use Go Daddy coupon codes OK7, GOO1 or ZINE8. $5 Off $30 or More – Use Go Daddy coupons GOO2 or ZINE9. 20% Off Any order of $50 or more – Use Godaddy coupon OK8.
Leave a Reply: