Welcome, Guest. Please Login
 
  HomeHelpSearchLogin FAQ Radified Ghost.Classic Ghost.New Bootable CD Blog  
 
Pages: 1 2 3 4
Send Topic Print
Rad Resource Usage at New VPS Server (Read 41847 times)
Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Rad Resource Usage at New VPS Server
Feb 21st, 2008 at 7:32pm
 
After getting booted off the "Producton server," and trading countless emails with Lunarpages support over the last few months about our resource usage there, I am understandably sensitive to this topic.

So I've been researching our resource usage at the new VPS server. They tell me our CPU usage (which was our #1 problem at Lunarpages) is insignificant. See here:

Quote:
Your CPU usage is minimal. Typing top in a SSH prompt will give you exact usage stats.

Rather, they say MEMORY is the problem most accounts run into on a VPS server.

If you recall, when I signed up with WiredTree (our new host), I was able to find (via Google query) a COUPON which got us NOT ONLY a 10% discount (or $5/month):

http://www.retailmenot.com/view/wiredtree.com

.. but MORE IMPORTANTLY (I'm learning) a free 128-MB RAM upgrade.

I say "more importantly," cuz it appears we have ALREADY EXCEEDED the standard allotment of 256-MB (RAM) which comes standard with our hosting package:

http://www.wiredtree.com/managedvps/index.php

In other words, if we didn't have the free 128-MB memory upgrade, we would *already* be over our limit.

I repeatedly asked pointed questions: "Are you *sure* I've been assigned 384-MB RAM? .. and not (the standard) 256?"

In all case both techs I've been dealing with *assure* me we've been asigned 384. The following emails are both from from WT sppt:

Quote:
Checking your config file you have 384Mb of RAM. If you didn't your server would be going over it's memory limit and that would cause issues. The system would start becoming unstable if you go over your RAM limit and start killing off processes.

Quote:
The most common resource a VPS runs out of first is RAM. Below is a reading of your current RAM usage:

-bash-3.1# free -m
            total       used       free     shared    buffers     cached
Mem:     1024        270        753          0          0          0
-/+ buffers/cache:  270        753
Swap:         0          0          0

Look at the used section which shows that you are using 270Mb out of your 384Mb. So with that said you have about 114Mb of free RAM which is a good thing. You can get your RAM usage at anytime by logging into your server via SSH as the root user and typing:

free -m

Quote:
There really isn't a way to check to see how much guaranteed RAM you have since when you check your memory, it will show you all memory including burstable. The limits should have been set correctly last night when I setup your server. However, just for good measure, I set them again. Let me know if you need anything else.

Apparently, the "total" figure comes from our "burstable" limit of 1-GB (or 1024-MB).

They also informed me that, if we were to run out of memory, we'd start getting errors, due to processes shutting down, and that we could upgrade our memory by increments of 64-MB at a rate of $7.50 per 64-MB.

Sooo .. the free 128-MB RAM upgrade we got (via coupon) equates in value to $15 .. or *triple* the 10% - off discount (which only equals $5). So it seems like that coupon was worth $20/month.

I asked why my old host didn't have any problems with my memory usage. Their response:

Quote:
Don't know what kind of setup they were running. VPS providers configure their servers differently or run totally different virtualization software which calculates RAM usage differently.

I asked them about installing and playing with Drupal .. if that would put us over 384-MB RAM. He didn't think so. See here:

Quote:
I wouldn't think that installing Drupal would push you over. I can't tell you if it would or not since there are so many factors involved when you run PHP driven site.

I would've hated to upgrade to a VPS .. only to be told we were *already* exceeding our resource allotment.
 
WWW  
IP Logged
 

MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #1 - Feb 22nd, 2008 at 1:24am
 
You could easily write a scheduled task to email you the amount of used memory and any other statistics you are interested in.  Let me know if you are interested and I'll show you where to look to learn how to do it.  Wouldn't take long to learn.  Maybe an hour.
 
WWW  
IP Logged
 
Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #2 - Feb 22nd, 2008 at 1:12pm
 
Yes, that would be cool. And this today from Lunarpages support.

Quote:
Hello,

We have moved your account back to the Production server. I sent the welcome e-mail. Please login and verify your site and account features function properly so we can terminate your old account.

If you have any further question related to this issue, feel free to contact us. We are committed to making your hosting experiences pleasant and fulfilling.
 
WWW  
IP Logged
 
MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #3 - Feb 22nd, 2008 at 3:43pm
 
So the easiest way to get an email with your performance stats is to write a BASH script and execute it with crontab.  A BASH script is little more than a series of shell commands saved in a text document and executed in order.  So, the first step is to determine what commands  you want to run.

'free -m' would be a good one to keep an eye on your memory.  Another one might be 'top -bn 1'.  That one will give you a snapshot of your top processes, cpu usage, load average, and memory usage.  There are a lot more options to top, so read the man page if you'd like to tweak it.

Add both of these commands (and/or any others you want) to a text file (each on a separate line.)  You can use the vi editor to create and edit the text file.  Vi takes some getting used to, so here's a helpful link:

http://www.wam.umd.edu/~petersd/vi.html

Once the text file is made, edit crontab to tell cron to run the script at whatever time you want.  The man pages will be your best friend here, but an example crontab entry might look like this:

0 0,12 * * * sh textfilename > DailyLog.txt 2>&1
1 0,12 * * * mail -s ServerStats youremail@yourdomain < DailyLog.txt

The first entry runs the script you wrote and puts the output into a text file.  The second entry mails that text file to youremail.  The first entry will run every day at midnight and noon.  The second entry runs one minute later.  The second command assumes that the sendmail service is running, which is should be on CentOS 5 by default.  The crontab man pages should explain how to run it at any time a day you want, as often as you want (up to once a minute.)

I'd be happy to help if you have any questions.
 
WWW  
IP Logged
 
Sunday_Afternoon
Gnarly
*
Offline


Long-time Radified lurker...

Posts: 26


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #4 - Feb 23rd, 2008 at 1:29am
 
MrMagoo wrote on Feb 22nd, 2008 at 3:43pm:
  You can use the vi editor to create and edit the text file.  Vi takes some getting used to, so here's a helpful link:


You don't say! vi is certainly an acquired taste and I managed to avoid having to learn it in my years of unix. emacs was installed on most systems, and if it wasn't I persuaded the admin to install it.

emacs is also available in compiled form for windows - I use it as my default text editor in vista.
 
 
IP Logged
 
MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #5 - Feb 23rd, 2008 at 2:38am
 
I've used both, and I didn't want my post to turn into a long explanation about the pluses and minuses of each, since volumes exist on the subject on other sites.  The bare basics of the version of vi that Cent5 includes by default aren't hard to learn - and it's friendlier than older Unix versions, so I'm guessing spending a few minutes learning vi will be easier at this point than learning to install emacs through 'yum' or 'RPM'.  "Persuading the admin to install it" isn't an option, since Rad has taken on that role himself.
 
WWW  
IP Logged
 

Sunday_Afternoon
Gnarly
*
Offline


Long-time Radified lurker...

Posts: 26


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #6 - Feb 23rd, 2008 at 9:37am
 
That's a good point about working with what is already there.

Good to hear that vi is friendlier than in my unix days. Back then vi users tended to be hard-core computer science types who appeared to me to get perverse pleasure out of using it. Lesser (saner?) mortals would quickly use something more intuitive.

 
 
IP Logged
 
Rad.Test
Technoluster
***
Offline


Rad's non-Admin test-profile
in Firefox

Posts: 108


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #7 - Feb 23rd, 2008 at 9:45am
 
I find these discussions interesting, tho I do not fully understand.

You guys seem to say vi comes with CentOS 5 by default, tho is more difficult to learn than another, similar text editor called emacs, which I would have to install (or let Magoo install).

I have not yet played with vi, but ask myself, "How hard can it be to learn a text editing prgm?"

I was focused, until late last night (midnight), trying to get the Movable Type blogging software working. For some strange reason, the script (mt.cgi) prompted a *download* .. instead of running the program:

http://forums.sixapart.com/index.php?showtopic=65176

Found a fix here:

http://orangescale.net/blognotes/movable-type/movable-type-troubleshooting-base-...

.. which involves tellling the program exactly where it resides via an absolute path > /home etc. ..using a "strict path"  Still have to apply the fix to older MT 3.35 install. (MTOS v4.1 now works.)

Now I'm trying to connect via SFTP/SSH2. Cute Pro is timing out on me. WiredTree sppt recommends this client:

http://winscp.net/eng/index.php

So I am still in the process of dialing in the new account and learning VPS skills. (I've never used SFTP before.)
 
 
IP Logged
 
MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #8 - Feb 23rd, 2008 at 1:53pm
 
WiredTree hasn't been steering you wrong.  WinSCP is a good program.  Since it works through scp, which is a file transfer protocol known as rcp that has been updated to use secure ssh tunneling, I have always found it much faster than FTP (and it is far more secure.)

Vi was designed to be much more than a simple text editor.  It has advanced search and replace functions, scripting functions, the ability to cut or copy any 32 abritrary strings and then paste any one of them back in later in the file, ect.  Since vi was written to be used from the command line, drop down menus weren't available to access these advanced features.  So you end up with the command to do a search and replace looking something like :%s/OLD/NEW/g.

The good news is, if you just want to edit the text, it isn't very complicated. 

1. From the command line, type 'vi textfile' to open or create a text file in vi
2. Press 'i' to get into insert mode.
3. Edit the file to your hearts content
4. Press 'ESC' to get out of insert mode
5. Press ':wq' to save the file and exit the editor

BONUS:
I just logged into one of my Cent5 servers and checked.  It seems the nano text editor is also installed by default.  Nano is dead simple to use (even more so than emacs.)  So, if you don't want to learn vi, use nano.  'nano textfile' to open the text file.  Edit normally.  'Ctlr-x' to save the file.
 
WWW  
IP Logged
 
Rad.Test
Technoluster
***
Offline


Rad's non-Admin test-profile
in Firefox

Posts: 108


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #9 - Feb 23rd, 2008 at 3:15pm
 
As a side note, I just noticed a folder on the root called "emacs". Not sure what this means, but it would seem the program is available, if not already installed. Data-point.

I still haven't gotten around to connecting via SFTP/SSH2.

Are these two terms synonymous? SFTP and SSH2?

Are you saying the extra security/encryption of SFTP does nothing to slow down the transfers/protocol, but rather SFTP is actually *faster* than FTP?
 
 
IP Logged
 
Sunday_Afternoon
Gnarly
*
Offline


Long-time Radified lurker...

Posts: 26


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #10 - Feb 23rd, 2008 at 4:10pm
 
Rad - at the command line, type:

Quote:
which emacs


if you get this response:

Quote:
emacs: Command not found.


then is isn't installed. However, if it is, you'll get back the absolute path to the emacs executable. You can to this with any program you are interested in to see if it is installed on your system and in your current $PATH.
 
 
IP Logged
 

MrMagoo
Übermensch
*****
Offline


Resident Linux Guru

Posts: 1026
Phoenix, AZ (USA)


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #11 - Feb 23rd, 2008 at 4:46pm
 
Rad.Test wrote on Feb 23rd, 2008 at 3:15pm:
Are these two terms synonymous? SFTP and SSH2?

Not synonymous, but related.  SSH is Secure SHell.  SSH2 is just an updated version of SSH.  Most people used them interchangeably.  It is a secure protocol for opening a connection to a server and logging in to give the server commands.  I hope that is how you are connecting to the server to get to the command line.  Putty and SecureCRT are popular SSH clients.  SSH was designed to replace telnet, which is the protocol programs like HyperTerminal uses.  Telnet is very insecure, sending all your commands across the connection in clear text for all to see.

SFTP is a file transfer protocol designed to tunnel file transfers across a secure connection.  Security is provided by the SSH protocol.  It shouldn't be any harder to use than downloading WinSCP and connecting to your server.  After that, it's pretty much drag and drop.

Quote:
Are you saying the extra security/encryption of SFTP does nothing to slow down the transfers/protocol, but rather SFTP is actually *faster* than FTP?

FTP is very old.  It was one of the first networking protocols developed, back in the days when security wasn't a concern.  SFTP is not directly related to FTP.  It is a much newer protocol, and therefor much faster and more reliable.  The security provided by SSH that SFTP uses has a negligible impact on the speed of the transfers (but a big impact on my piece of mind.)
 
WWW  
IP Logged
 
Rad.Test
Technoluster
***
Offline


Rad's non-Admin test-profile
in Firefox

Posts: 108


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #12 - Feb 24th, 2008 at 12:56am
 
Thanks.

I'm a little frustrated, cuz I just want to get the command line to check free -m

I can now connect via SFTP drag-n-drop files, just like regular FTP, but when I tried PuTTY to get command line, it told me "Shell access is not enabled on your account."

So I'm finding out how to enable shell access now. I've been at this for days it seems.

I will x-fer via WinSCP if you say that's the way to go.

Here are some stats I found in a different part of WebHost Mgr:

Quote:
Current Memory Usage
            total           used         free
Mem:     1048576     303952     744624

.. which would indicate we're using ~300MB, with 75MB remaining free.
 
 
IP Logged
 
Rad.Test
Technoluster
***
Offline


Rad's non-Admin test-profile
in Firefox

Posts: 108


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #13 - Feb 24th, 2008 at 1:40am
 
Okay, I finally got shell access. Woohoo!

free -m

Quote:
             total       used       free
Mem:      1024        270        753

 
 
IP Logged
 
Rad
Radministrator
*****
Offline


Sufferin' succotash

Posts: 4090
Newport Beach, California


Back to top
Re: Rad Resource Usage at New VPS Server
Reply #14 - Feb 24th, 2008 at 10:15am
 
Here's graph from WiredTree's monitoring program interface, which they say has same accuracy as shell access:

...

They said the "Allocated" number comes from fact that:

Quote:
Programs often allocate more memory to be used than they are actual using.
 
WWW  
IP Logged
 
Pages: 1 2 3 4
Send Topic Print