LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-27-2012, 07:41 AM   #1
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Rep: Reputation: 15
LAMP server perfornace on Amazon


Guys... I am working with a client who has a m2.xlarge instance on Amazon AWS.

High-Memory Extra Large (m2.xlarge)
6.5 ECUs
2 Cores
17.1 GB

It's running as a LAMP server.... and it's a dynamic site.

This is consuming so much Mem. and CPU. What do I need to do to improve server performance ?

It's using all the 17GB the server has. I don't understand. Mysql is the one who is taking most memory usage. Can some of you please help me ? I really appreciate Thanks

top - 08:39:52 up 8 days, 17:17, 1 user, load average: 2.39, 2.77, 2.71
Tasks: 86 total, 3 running, 83 sleeping, 0 stopped, 0 zombie
Cpu(s): 65.1%us, 25.5%sy, 0.0%ni, 9.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.2%st
Mem: 17920000k total, 17537304k used, 382696k free, 3581084k buffers
Swap: 0k total, 0k used, 0k free, 3803376k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7908 iwd 25 0 103m 7180 3008 R 99.3 0.0 2219:51 svn
2668 mysql 16 0 358m 99m 7528 S 75.7 0.6 3483:18 mysqld
6503 apache 16 0 344m 28m 4852 S 2.7 0.2 0:53.35 httpd
3900 iwd 16 0 252m 68m 6588 S 1.3 0.4 1:25.17 php
1 root 16 0 10348 676 572 S 0.0 0.0 0:00.12 init
 
Old 04-27-2012, 08:38 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,406

Rep: Reputation: 863Reputation: 863Reputation: 863Reputation: 863Reputation: 863Reputation: 863Reputation: 863
Do any of the MySQL databases make use of MEMORY for a table storage engine? If so, what size of tables are they? MySQL will also tend to grab memory for use as a cache.

What is the output of sar? What processes are using the most memory and cpu when you look at the output of top over time?

Those may give you a clue.
 
Old 04-27-2012, 09:16 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,326
Blog Entries: 4

Rep: Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842
Suggested reading:

http://www.mysqlperformanceblog.com/...-memory-usage/

http://www.omh.cc/mycnf/ (a my.cnf analyzer with links to related references)

https://paragasu.wordpress.com/2008/...configuration/ (a tight fit...)

http://www.ovaistariq.net/358/tuning...rver-settings/

A key thing to realize about high-performance server programs is that, left to their own devisings (which you shouldn't do), they know that "memory is the fastest thing there is." So they naturally tend to favor the use of it. But... they have no way to know what's virtual and what's not. They also don't know what other applications are in the same box with them; they don't know how their activities are affecting others.

In the case of an Amazon cloud (virtual machine ...) server, you also don't know anything about their silicon except that it's "beefy." You can naturally assume that Amazon has moderately over-committed their servers (this is a pragmatic fact, not a slam...) but you don't know by how much.

Therefore, you need to configure your total-deployment of software within your server so that, (a) the various players are "good, friendly companions" with one another, and (b) the virtual-machine they all live in is "a good, friendly companion" with all the other VM's in the same (unknown to you...) box.

Therefore, decide how much RAM you're going to use (a less-than-100% percentage of what you've been promised), and carve that space up among the various processes assuming that all of them are going "hell-bent to leather" processing the biggest orders you've ever had, for five of the most important customer you've ever dreamed of. Configure each server process so that it knows "the honest-to-stars truth" about what it's allowed to have use of, such that it can be guaranteed the use of those resources on a continuous basis under aggressive loads (without significant swap activity).

Last edited by sundialsvcs; 04-27-2012 at 09:19 AM.
 
1 members found this post helpful.
Old 04-27-2012, 01:48 PM   #4
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Original Poster
Rep: Reputation: 15
I am trying those things.. but there's something that I really don't understand...

the server has 17.1 GB of memory....

then LAMP is up.. this is the memory usage.
Quote:
free -m
total used free shared buffers cached
Mem: 17500 17184 315 0 2778 4479
-/+ buffers/cache: 9926 7573
Swap:
0 0 0



When I turn off mysqld and httpd (which are the most consuming process in cpu and memory) The memory usage still almost as the same value



Quote:
#free -m
total used free shared buffers cached
Mem: 17500 16698 801 0 2778 4478
-/+ buffers/cache: 9441 8058
Swap: 0 0 0
 
Old 04-27-2012, 02:18 PM   #5
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Run this command:

Code:
cat /proc/meminfo | grep -i inactive
Do some reading on linux kernel memory management. It will almost always show very little free memory due to the fact that it does not clean and free up memory that was used previously until another application needs it. It will be lumped into your 'cached' section and will be marked as 'dirty inactive' memory.


It sounds like your client is more than likely running a WordPress or Joomla site with those symptoms, I have seen it enough times now to now. First thing to do is set MySQL to log your slow queries, you will more than likely find you have queries that are taking 10-30 seconds to complete and are killing the utilization of the server. That is due to the tables not being indexed properly for the queries it is running.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How To Create A LAMP Setup (Apache2, PHP, MySQL) On CentOS 5.x In An Amazon Linux AMI 32bits O LXer Syndicated Linux News 0 02-07-2011 09:11 AM
Centos LAMP Server with unidentified script causing server to port scan ZS- Linux - Security 48 01-30-2011 07:27 AM
Setting up Ubuntu LAMP Server for local web server sewmyheadon Linux - Newbie 5 02-11-2007 02:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration