New user and worried about the graphs
19 Replies
The cpu isn't anything you need to worry about, you can go as far as 400% before all your cpu power is being used since you have 4 cores, so 100% = 1 core.
@obs:
To fix the swap issue check out this
especially the apache bit. http://library.linode.com/troubleshooti … networking">http://library.linode.com/troubleshooting/memory-networking
According to the tutorial:
ServerLimit 24
MaxClients 24
Even that can be too high, especially if you use one of those modern, heavyweight CMS's like WordPress. Reduce them both to 16 and see if it helps reduce CPU usage and disk I/O.
Do this, install APC, and run mysqltuner.pl
free -m
ps aux
vmstat 1 30
(the vmstat command will run for 30 seconds, then exit)
Post the output here and everyone will opine on it.
From a prioritization standpoint, getting your swap I/O under control is probably #1. That slows everything down.
Next, your disk I/O is rather high. Figuring out whether it is reading or writing is key, as is figuring out exactly what is doing the reading or writing. The vmstat command will help a bit with this, but iotop is sometimes useful. (Most of the time, though, it doesn't tell me anything I don't already know. Whoop-de-flippin'-doo, mysqld is doing most of the I/O on my database server…)
CPU is CPU. There are lots of them in each host, and the most you can use at one time are four. The kicker with CPU is that you can only crunch data so fast, so if you're using a lot of CPU, your site is going to be slow.
If you can split up your tasks between multiple servers such that they're all sharing the I/O burden equally, life can be pretty good. I usually end up having a set of database servers, a set of web servers, and then some number of servers for other services (solr, memcached, postfix, munin/nagios/etc, SVN, …). Make a block diagram of your operations, with lines denoting dependency, and little symbols indicating "does a lot of IO", "uses CPU like a drunken squirrel", "needs 4 GB of RAM", etc. You don't need to deploy your system such that you have no more than one block per server, but since each block should be able to talk to the other blocks it depends on over IP, you could.
(Beware the dreaded Distributed Single Point of Failure.)
@andrewgjohnson:
Hmm it seems like that linode library article and mysqltuner.pl are giving me conflicting advice.
Every article has specific performance goals. The MySQL portion of the article is meant to minimize memory consumption as much as possible. This might not be a good idea when you're trying to reduce CPU and I/O. Follow mysqltuner.pl, because it knows more about your specific setup than any general-purpose guide ever can. Besides, mysqltuner.pl will also tell you if your settings use excessive memory.
@andrewgjohnson:
One good thing is apparently I have a join somewhere without an index so I will hunt that down but other than that I am still kind of stuck. Making those changes didn't lower my IO graph at all, in fact it's even higher now.
That could be the reason for your high CPU and I/O. An unindexed query needs to scan the entire table, which obviously causes a lot of disk access. Turn on slow query logs and you'll be able to find the offending query in a few hours.
@andrewgjohnson:
I installed and implemented memcache yesterday [as opposed to APC.]
Memcache is not a replacement for APC. Memcache reduces database load by storing query results in memory. APC makes PHP scripts run faster by storing the compiled opcode in memory. Use them both, but watch your memory usage. (You don't need to do anything to take advantage of APC. Just install it and forget about it.)
@andrewgjohnson:
I served something between 5000 and 6000 pageviews yesterday. I don't think that is very high but let me know. Once I move all my sites over I'll be peaking somewhere between 7000 and 8000 pageviews a day.
That's very low. A well-optimized Linode 512 running an off-the-shelf blog or forum software (including SMF) can serve thousands of dynamic pages every few minutes, let alone every day.
@andrewgjohnson:
Either upgrading my current linode or getting a second one would solve that so I was wondering which would likely give me a better performance boost. If you're hitting your bandwidth limit, yes, both options would cost you the same. But there's little reason to get two linodes unless your linode is already too big to upgrade or you need geographical redundancy. Just upgrade. It's easier to maintain one server than it is to maintain multiple servers and make them interoperate all the time.
[mysqld]
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 1
log-queries-not-using-indexes
log-output=TABLE
It'll create a table called slow_log in the mysql database which logs queries that take longer than 1 second or don't use indexes, you can then use your favourite mysql client to search for the queries in that table.
/usr/sbin/mysqld
from a root shell and see if it outputs any more information
For IPv6 you probably have some daemon using it, ntp would be a good guess
If you run
netstat -lpntu6
it'll tell you what's listening on ipv6 (replace the 6 with a 4 for ipv4 traffic and omit the number to show both)
Personally I just block all ipv6 traffic with iptables if I'm not going to use it.