hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : VPS Hosting : VPS Tutorials : No SWAP memory on a VPS?
Reply

VPS Tutorials Tutorials related to VPS.
Forum Jump

No SWAP memory on a VPS?

Reply Post New Thread In VPS Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 04-29-2011, 09:47 AM
rezilient rezilient is offline
WHT Addict
 
Join Date: May 2005
Location: Toronto / New York
Posts: 154

No SWAP memory on a VPS?


When I asked why my managed VPS was configured with no swap, and that it please be configured I was told this by my VPS provider:

Its not possible to add swap partition on a VPS, and there is no need to create separate swap file. You can keep track of the memory usage in power panel under resource alerts. If the VPS is using up the memory allocated, you can see the alerts there.

I realize that it's "best" to never start swapping a lot, but my understanding was that if memory was low, some virtual memory would keep you going at least, to avoid services from crashing or worse.

Thoughts?

Reply With Quote


Sponsored Links
  #2  
Old 04-29-2011, 09:51 AM
rds100 rds100 is offline
Premium Member
 
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,165
If it is an OpenVZ VPS there is simply no such thing as swap.
If it is Xen you can easily add swap yourself.

Reply With Quote
  #3  
Old 04-29-2011, 09:55 AM
rezilient rezilient is offline
WHT Addict
 
Join Date: May 2005
Location: Toronto / New York
Posts: 154
Quote:
Originally Posted by rds100 View Post
If it is an OpenVZ VPS there is simply no such thing as swap.
If it is Xen you can easily add swap yourself.
What about Parallels Virtuozzo?

I'm coming from a Xen VM, so the information about OpenVZ is new to me. Can someone explain?

Reply With Quote
Sponsored Links
  #4  
Old 04-29-2011, 09:58 AM
rds100 rds100 is offline
Premium Member
 
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,165
Virtuozzo is OpenVZ so there is no swap. OpenVZ has "guranteed RAM" and "burst RAM".

Reply With Quote
  #5  
Old 04-29-2011, 10:04 AM
rezilient rezilient is offline
WHT Addict
 
Join Date: May 2005
Location: Toronto / New York
Posts: 154
Quote:
Originally Posted by rds100 View Post
Virtuozzo is OpenVZ so there is no swap. OpenVZ has "guranteed RAM" and "burst RAM".
Ok interesting, so if I'm down to 0MB free what will I see on my VM? Will the amount of memory change when it "bursts"? Here is what I'm seeing now in free -m. Also what about the typical "cached" RAM that Linux would reserve, right now I'm seeing none.

Code:
[root@host ~]# free -m
             total       used       free     shared    buffers     cached
Mem:           768         80        687          0          0          0
-/+ buffers/cache:         80        687
Swap:            0          0          0
Thanks!

Reply With Quote
  #6  
Old 04-29-2011, 10:08 AM
rds100 rds100 is offline
Premium Member
 
Join Date: Jan 2011
Location: Varna, Bulgaria
Posts: 1,165
No, the maximum memory you can burst to is 768MB. How much of that is guranteed cannot be seen this way.
cat /proc/user_beancounters to see various OpenVZ limits and statistics. And then look at http://wiki.openvz.org/UBC to see what they mean.

Also there is not cached memory because the VPS doesn't do any caching, it doesn't even have its own kernel. There is only one kernel on the hardware node, and your VPS just has processes isolated in a container. The chaching is done at the hardware node level.

Reply With Quote
  #7  
Old 05-11-2011, 07:46 PM
stardust_x7 stardust_x7 is offline
Temporarily Suspended
 
Join Date: May 2011
Location: N/A
Posts: 116
* How can we?

Quote:
Originally Posted by rds100 View Post
If it is an OpenVZ VPS there is simply no such thing as swap.
If it is Xen you can easily add swap yourself.
Under Xen how can we add swap?

Reply With Quote
  #8  
Old 05-11-2011, 07:47 PM
Crothers Crothers is online now
Web Hosting Master
 
Join Date: Apr 2008
Location: United States, MI
Posts: 553
Quote:
Originally Posted by stardust_x7 View Post
Under Xen how can we add swap?
Create a partition on your disk and format it to be swap?

IE: The same way you add swap on all Linux systems.

Reply With Quote
  #9  
Old 05-23-2011, 05:05 PM
dmmcintyre3 dmmcintyre3 is offline
Aspiring Evangelist
 
Join Date: Apr 2010
Location: North Carolina
Posts: 429
Quote:
Originally Posted by stardust_x7 View Post
Under Xen how can we add swap?
http://www.cyberciti.biz/faq/linux-a...ap-file-howto/

Reply With Quote
  #10  
Old 05-23-2011, 09:03 PM
monty1983 monty1983 is offline
Junior Guru Wannabe
 
Join Date: Feb 2010
Location: Evanston, IL
Posts: 53
Most hosts don;t like to offer swap because of the load it generates on the SANs, I/O from alot of random reads and writes.

If swap is something you really need you can create a swap file, adjust to following to suit your needs:

1) Create a file to use as swap:
-this command will create 1GB file
dd if=/dev/zero of=/swapper bs=1M count=1024

2) Create a swap are in the file:
mkswap /swapper

3) Turn the swap on:
swapon /swapper

4) To make the swap area persistent on reboot add the following line to /etc/fstab:

/swapper swap swap defaults 0 0

5) Run:

free -m

You should now see your available swap space.

Reply With Quote
  #11  
Old 05-30-2011, 04:16 PM
Dig1 Dig1 is offline
WHT Addict
 
Join Date: Mar 2011
Location: florida
Posts: 155
Openvz swap file install works perfect
[root@s1 ~]# free -m
total used free shared buffers cached
Mem: 512 325 186 0 0 0
-/+ buffers/cache: 325 186
Swap: 1024 0 1024
[root@s1 ~]#
i only have 512mb ram
now i have a swap as seen in root also as seen in webmin running proc
Display : PID | User | Memory | CPU | Search | Run..

Real memory: 512 MB total / 186.25 MB free Swap space: 1024 MB total / 1024 MB free
i dont run outa memory no more
OpenVZ does not support Swap. If you have a program that requires swap, then you can create and use a fake swap.
1) Log into your vps as root.
2) Download fake-swap.sh shell-script.
wget XXhttpX:X/X/service.welcome2inter.net/downloads/fake-swap.sh
3) Make script executeable
chmod u+x fake-swap.sh
4) Run script to create fake swap ...
... with 512MB (default)
./fake-swap.sh
Enjoy



... with 1024MB

./fake-swap.sh 1024

Reply With Quote
  #12  
Old 07-05-2011, 05:11 AM
skoh skoh is offline
WHT Addict
 
Join Date: Oct 2010
Posts: 129
Quote:
Originally Posted by Dig1 View Post
Openvz swap file install works perfect
...
i dont run outa memory no more
The swap is fake. It is used to fool applications so that they think there is swap space available but in actual fact there is none. You will still run out of memory if you use that fake-swap.sh.

Reply With Quote
  #13  
Old 07-18-2011, 04:36 AM
karigaalan karigaalan is offline
Newbie
 
Join Date: Jul 2011
Posts: 6
my vps too have the same problem

Reply With Quote
  #14  
Old 07-18-2011, 02:13 PM
Echizen Echizen is offline
WHT Addict
 
Join Date: Jun 2010
Location: Java Island
Posts: 139
virtuozzo/openvz vps doesn't support swap, if you need swap for your development move your app to Xen box!

Reply With Quote
  #15  
Old 07-20-2011, 12:50 PM
Harel Harel is offline
Junior Guru Wannabe
 
Join Date: Jul 2011
Posts: 88
Yes and shared between other boxes too.

Kind Regards
.
.

Quote:
Originally Posted by rds100 View Post
Virtuozzo is OpenVZ so there is no swap. OpenVZ has "guranteed RAM" and "burst RAM".

Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Swap memory/Physical Memory twinmom Dedicated Server 8 03-22-2011 08:23 PM
[UK] Xen VPS November Special £3.50 - 192MB Memory, 384MB Swap, 8GB Disk, 200GB Data allsimple VPS Hosting Offers 0 11-23-2010 08:18 AM
Swap memory on Xen VPS lovelycesar VPS Hosting 13 11-13-2010 07:58 AM
[UK] Xen VPS 10% OFF also 512M Memory, 1G Swap, 20GB Disk, 400GB Transfer for £9 allsimple VPS Hosting Offers 4 10-02-2010 05:07 PM
[UK] Xen VPS 10% OFF or 512M Memory, 1G Swap, 20GB Disk, 400GB Transfer £9 Offer allsimple VPS Hosting Offers 0 10-02-2010 04:34 AM

Related posts from TheWhir.com
Title Type Date Posted
VMware Launches Version 7.0 of GemFire In-Memory Data Platform Web Hosting News 2012-10-30 12:35:15
Web Host MochaHost Adds New Features to Linux VPS Hosting Plans Web Hosting News 2012-08-01 15:52:14
Peak Hosting Launches Dell R815 Dedicated Server for Large Scale Memory Requirements Web Hosting News 2012-07-13 14:31:31
Web Host InMotion Upgrades VPS with More Memory, Bandwidth Web Hosting News 2012-03-08 14:15:08
Web Host Amazon Web Services Launches ElastiCache Service Web Hosting News 2011-08-23 17:53:00


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?