Fine Tuning Apache/MySQL

5 posts / 0 new
Last post
#1 Thu, 04/21/2011 - 12:08
zahir

Fine Tuning Apache/MySQL

I'm running a linux cloud server with the following config 1.2ghz Processor allocation 752MB Ram

The site loads slow and clicking a link almost freezes the page for a second. Also, the page loads could be much faster. We've been running mysqltuner and have pretty much optimized all slow queries. Is there anything we can do to fine tune the server for faster and more responsive?

Httpd.conf

Timeout 20 KeepAlive Off MaxKeepAliveRequests 100 KeepAliveTimeout 5 StartServers 2 MinSpareServers 1 MaxSpareServers 5 MaxRequestsPerChild 4000 ServerLimit 256 MaxClients 256

my.cnf

[mysqld] datadir = /var/lib/mysql socket = /var/lib/mysql/mysql.sock user=mysql log-error=/var/log/mysqld.log log-slow-queries = /var/log/mysql-slow-queries query_cache_size=16M old_passwords=1

[mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid

Thu, 04/21/2011 - 12:15
andreychek

You could try using Yahoo's "Yslow" Firefox plugin to see if what you're seeing could be a problem in the HTML/CSS/Javascript:

http://developer.yahoo.com/yslow/

Thu, 04/21/2011 - 12:16
zahir

80+ on gtmetrix :)

Tue, 04/26/2011 - 03:56
zahir

We've upgraded our server but its still painfully slow CPU 1.8ghz (Xeon 4-core Cloud) RAM 1.2Gb

I think somethings off

this is the output of pc

[root@server ~]# ps -ylC httpd --sort:rss S UID PID PPID C PRI NI RSS SZ WCHAN TTY TIME CMD S 48 27795 27794 0 78 0 4380 59417 494150 ? 00:00:00 httpd S 48 27799 27794 0 75 0 12608 79886 semtim ? 00:00:00 httpd S 48 27856 27794 0 75 0 12644 79882 - ? 00:00:00 httpd S 48 27806 27794 0 75 0 12684 79884 semtim ? 00:00:00 httpd S 48 27798 27794 0 75 0 12756 79884 - ? 00:00:00 httpd S 48 27797 27794 0 76 0 12996 79948 429493 ? 00:00:00 httpd S 48 27800 27794 0 75 0 13276 80023 semtim ? 00:00:00 httpd S 48 27808 27794 0 75 0 13280 79961 semtim ? 00:00:00 httpd S 48 27805 27794 0 75 0 13396 80030 semtim ? 00:00:00 httpd S 0 27794 1 0 78 0 16212 79597 - ? 00:00:00 httpd

Output of free -m is

[root@server ~]# free -m total used free shared buffers cached Mem: 1128 1069 58 0 222 507 -/+ buffers/cache: 339 788 Swap: 203 0 203

Our current httpd.conf config is

KeepAlive = On MaxKeepAliveRequests = 80 KeepAliveTimeout = 2 Timeout = 20 StartServers 3 MinSpareServers 3 MaxSpareServers 8 ServerLimit 100 MaxClients 100 MaxRequestsPerChild 2000

and my.cnf is

mysqld] datadir = /var/lib/mysql socket = /var/lib/mysql/mysql.sock user=mysql log-error=/var/log/mysqld.log log-slow-queries = /var/log/mysql-slow-queries log_queries_not_using_indexes=1 query_cache_size=16M max_connections=125 long_query_time=5

old_passwords=1 table_cache=512 read_buffer_size=1M join_buffer_size=2097152 thread_cache_size=4

[mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid ~

Help appreciated

Tue, 04/26/2011 - 08:13
andreychek

Howdy,

Well, there's a lot of moving parts in a database backed website -- and the key is to figure out which of those moving parts is the problem.

None of the configs you listed above have any obvious problems.

One of the things I'd probably do just for testing is to install something like WordPress onto one of your Virtual Servers, and see how it performs.

That would help show if all web apps are having problems, or if it's specific to the one you're working with.

-Eric

Topic locked