<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en" xml:base="http://themattreid.com/wordpress/wp-atom.php">
	<title type="text">{themattreid}</title>
	<subtitle type="text">MySQL DBA | Linux'er</subtitle>

	<updated>2010-08-30T21:57:28Z</updated>

	<link rel="alternate" type="text/html" href="http://themattreid.com/wordpress" />
	<id>http://themattreid.com/wordpress/feed/atom/</id>
	

	<generator uri="http://wordpress.org/" version="3.0.1">WordPress</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Themattreid" /><feedburner:info uri="themattreid" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[Easy Python: multi-threading MySQL queries]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/IwxtCtyjJxg/" />
		<id>http://themattreid.com/wordpress/?p=356</id>
		<updated>2010-08-30T21:57:28Z</updated>
		<published>2010-08-30T21:04:24Z</published>
		<category scheme="http://themattreid.com/wordpress" term="Python" /><category scheme="http://themattreid.com/wordpress" term="Scripts" /><category scheme="http://themattreid.com/wordpress" term="Uncategorized" /><category scheme="http://themattreid.com/wordpress" term="mysql" /><category scheme="http://themattreid.com/wordpress" term="Mysql server" /><category scheme="http://themattreid.com/wordpress" term="Programming" /><category scheme="http://themattreid.com/wordpress" term="scripting" /><category scheme="http://themattreid.com/wordpress" term="threading" />		<summary type="html"><![CDATA[<p>There are many times when writing an application that single threaded database operations are simply too slow. In these cases it&#8217;s a matter of course that you&#8217;ll use multi-threading or forking to spawn secondary processes to handle the database actions. In this simple example for Python multi-threading you&#8217;ll see the how simple it is to improve the performance of your python app.</p>
<pre name="code" class="py">
#!/usr/bin/python
## DATE: 2010-08-30
## AUTHOR: Matt Reid
## WEBSITE:</pre><p>&#8230; <a href="http://themattreid.com/wordpress/2010/08/30/easy-python-threading-mysql-connections/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/08/30/easy-python-threading-mysql-connections/">&lt;p&gt;There are many times when writing an application that single threaded database operations are simply too slow. In these cases it&amp;#8217;s a matter of course that you&amp;#8217;ll use multi-threading or forking to spawn secondary processes to handle the database actions. In this simple example for Python multi-threading you&amp;#8217;ll see the how simple it is to improve the performance of your python app.&lt;/p&gt;
&lt;pre name="code" class="py"&gt;
#!/usr/bin/python
## DATE: 2010-08-30
## AUTHOR: Matt Reid
## WEBSITE: http://themattreid.com
## LICENSE: BSD http://www.opensource.org/licenses/bsd-license.php
## Copyright 2010-present Matt Reid

from __future__ import division
from socket import gethostname;
import threading
import sys
import os
import MySQLdb

class threader(threading.Thread):
    def __init__(self,method):
        threading.Thread.__init__(self)
        self.tx =
        self.method = method
    def run(self):
        run_insert()

def run_insert():
    sql = "INSERT INTO table (`id`,`A`,`B`,`C`) VALUES (NULL,'0','0','0');")
        try:
            cursor.execute(sql)
            db.commit()
        except:
            print "insert failed"

def init_thread():
    for thread in range(threads):
        background = threader()
    background.start()
    background.join()

def main():
    try:
        init_thread()
    except:
        print "failed to initiate threads"

    sys.exit(0)

if __name__ == "__main__":
    mysql_host = "localhost" #default localhost
    mysql_pass = "pass" #default dbbench
    mysql_user = "user" #default dbbench
    mysql_port = 3306 #default 3306
    mysql_db = "schema" #default dbbench
    threads = 4 #must be INT not STR

    try:
        db = MySQLdb.connect(host=mysql_host, user=mysql_user, passwd=mysql_pass, db=mysql_db, port=mysql_port)
    except MySQLdb.Error, e:
        print "Error %d: %s" % (e.args[0], e.args[1])
        sys.exit (1)
    cursor = db.cursor()

    main()
    db.close()
&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/IwxtCtyjJxg" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/08/30/easy-python-threading-mysql-connections/#comments" thr:count="3" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/08/30/easy-python-threading-mysql-connections/feed/atom/" thr:count="3" />
		<thr:total>3</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/08/30/easy-python-threading-mysql-connections/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[Easy Python: display LVM details in XML]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/GKuUtKn5ct4/" />
		<id>http://themattreid.com/wordpress/?p=338</id>
		<updated>2010-08-30T19:49:50Z</updated>
		<published>2010-08-15T22:35:30Z</published>
		<category scheme="http://themattreid.com/wordpress" term="Python" /><category scheme="http://themattreid.com/wordpress" term="Scripts" /><category scheme="http://themattreid.com/wordpress" term="linux" /><category scheme="http://themattreid.com/wordpress" term="lvm" /><category scheme="http://themattreid.com/wordpress" term="mysql" /><category scheme="http://themattreid.com/wordpress" term="Mysql server" /><category scheme="http://themattreid.com/wordpress" term="Programming" /><category scheme="http://themattreid.com/wordpress" term="scripting" />		<summary type="html"><![CDATA[<p>If you need to work with LVM in your scripts but haven&#8217;t found a good method to access details about Logical Volume Groups, here&#8217;s a simple Python script that will print the details about any volumes on your system. This could be useful for writing a partition check script for your MySQL data directory (if you&#8217;re not using a standard monitoring system like Nagios). </p>
<pre name="code" class="py">
import sys
import os
import commands
import</pre><p>&#8230; <a href="http://themattreid.com/wordpress/2010/08/15/easy-python-display-lvm-details-in-xml/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/08/15/easy-python-display-lvm-details-in-xml/">&lt;p&gt;If you need to work with LVM in your scripts but haven&amp;#8217;t found a good method to access details about Logical Volume Groups, here&amp;#8217;s a simple Python script that will print the details about any volumes on your system. This could be useful for writing a partition check script for your MySQL data directory (if you&amp;#8217;re not using a standard monitoring system like Nagios). &lt;/p&gt;
&lt;pre name="code" class="py"&gt;
import sys
import os
import commands
import subprocess
import select

def lvm():
    print ""
    LVM_PATH = "/sbin"
    LVM_BIN = os.path.join(LVM_PATH, 'lvm')
    argv = list()
    argv.append(LVM_BIN)
    argv.append("lvs")
    argv.append("--nosuffix")
    argv.append("--noheadings")
    argv.append("--units")
    argv.append("b")
    argv.append("--separator")
    argv.append(";")
    argv.append("-o")
    argv.append("lv_name,vg_name,lv_size")

    process = subprocess.Popen(argv, stdout=subprocess.PIPE)
    output = ""
    out = process.stdout.readline()
    output += out
    lines = output.splitlines()
    for line in lines:
        line = line.strip()
        words = line.split(";")

        lvname = words[0].strip()
        vgname = words[1].strip()
        lv_size = int(words[2])
        print '''
    %s
    %s
    %s
  '''%(lvname, vgname, lv_size)

    print ""

lvm()&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/GKuUtKn5ct4" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/08/15/easy-python-display-lvm-details-in-xml/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/08/15/easy-python-display-lvm-details-in-xml/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/08/15/easy-python-display-lvm-details-in-xml/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[Easy MySQL: how to backup databases to a remote machine]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/norEmR7Vh9Q/" />
		<id>http://themattreid.com/wordpress/?p=335</id>
		<updated>2010-08-13T21:28:05Z</updated>
		<published>2010-08-13T21:27:39Z</published>
		<category scheme="http://themattreid.com/wordpress" term="Backups" /><category scheme="http://themattreid.com/wordpress" term="Mysql server" /><category scheme="http://themattreid.com/wordpress" term="Scripts" /><category scheme="http://themattreid.com/wordpress" term="bash" /><category scheme="http://themattreid.com/wordpress" term="linux" /><category scheme="http://themattreid.com/wordpress" term="mysql" /><category scheme="http://themattreid.com/wordpress" term="mysqldump" /><category scheme="http://themattreid.com/wordpress" term="scp" /><category scheme="http://themattreid.com/wordpress" term="scripting" /><category scheme="http://themattreid.com/wordpress" term="solaris" /><category scheme="http://themattreid.com/wordpress" term="ssh" />		<summary type="html"><![CDATA[<p>Here&#8217;s a simple answer to a simple question. &#8220;How do I run a backup of MySQL to another machine without writing to the local server&#8217;s filesystem?&#8221; &#8211; this is especially useful if you are running out of space on the local server and cannot write a temporary file to the filesystem during backups. </p>
<p>Method one &#8211; this writes a remote file.<br />
<code>mysqldump [options] [db_name&#124;--all-databases]&#124; gzip -c &#124; ssh user@host.com "cat > /path/to/new/file.sql.gz"</code></p>
<p>Method&#8230; <a href="http://themattreid.com/wordpress/2010/08/13/easy-mysql-how-to-backup-databases-to-a-remote-machine/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/08/13/easy-mysql-how-to-backup-databases-to-a-remote-machine/">&lt;p&gt;Here&amp;#8217;s a simple answer to a simple question. &amp;#8220;How do I run a backup of MySQL to another machine without writing to the local server&amp;#8217;s filesystem?&amp;#8221; &amp;#8211; this is especially useful if you are running out of space on the local server and cannot write a temporary file to the filesystem during backups. &lt;/p&gt;
&lt;p&gt;Method one &amp;#8211; this writes a remote file.&lt;br /&gt;
&lt;code&gt;mysqldump [options] [db_name|--all-databases]| gzip -c | ssh user@host.com "cat &gt; /path/to/new/file.sql.gz"&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Method two &amp;#8211; this writes directly into a remote mysql server&lt;br /&gt;
&lt;code&gt;mysqldump [options] [db_name|--all-databases]| mysql --host=[remote host] –user=root –password=[pass] [db_name]&lt;/code&gt;&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/norEmR7Vh9Q" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/08/13/easy-mysql-how-to-backup-databases-to-a-remote-machine/#comments" thr:count="6" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/08/13/easy-mysql-how-to-backup-databases-to-a-remote-machine/feed/atom/" thr:count="6" />
		<thr:total>6</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/08/13/easy-mysql-how-to-backup-databases-to-a-remote-machine/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[Easy Python: MySQL connection and iteration]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/Pc4vd62lduo/" />
		<id>http://themattreid.com/wordpress/?p=330</id>
		<updated>2010-08-30T19:52:47Z</updated>
		<published>2010-08-10T19:25:28Z</published>
		<category scheme="http://themattreid.com/wordpress" term="Programming" /><category scheme="http://themattreid.com/wordpress" term="Python" /><category scheme="http://themattreid.com/wordpress" term="Scripts" />		<summary type="html"><![CDATA[<p>If you&#8217;ve been looking for a simple python script to use with MySQL that you can use to expand upon for your next project, check this one out. It has error handling for the connection, error handling for the sql call, and loop iteration for the rows returned. </p>
<pre name="code" class="py">
#!/usr/bin/python
import sys
import MySQLdb

my_host = "localhost"
my_user = "user"
my_pass = "password"
my_db = "test"

try:
    db = MySQLdb.connect(host=my_host, user=my_user, passwd=my_pass,</pre><p>&#8230; <a href="http://themattreid.com/wordpress/2010/08/10/simple-python-mysql-connection-and-iteration/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/08/10/simple-python-mysql-connection-and-iteration/">&lt;p&gt;If you&amp;#8217;ve been looking for a simple python script to use with MySQL that you can use to expand upon for your next project, check this one out. It has error handling for the connection, error handling for the sql call, and loop iteration for the rows returned. &lt;/p&gt;
&lt;pre name="code" class="py"&gt;
#!/usr/bin/python
import sys
import MySQLdb

my_host = "localhost"
my_user = "user"
my_pass = "password"
my_db = "test"

try:
    db = MySQLdb.connect(host=my_host, user=my_user, passwd=my_pass, db=my_db)
except MySQLdb.Error, e:
     print "Error %d: %s" % (e.args[0], e.args[1])
     sys.exit (1)

cursor = db.cursor()
sql = "select column1, column2 from table";
cursor.execute(sql)
results = cursor.fetchall()
for row in results:
    column1 = row[0]
    column2 = row[1]
    print "column1: %s, column2: %s"%(column1,column2)

db.close()
&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/Pc4vd62lduo" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/08/10/simple-python-mysql-connection-and-iteration/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/08/10/simple-python-mysql-connection-and-iteration/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/08/10/simple-python-mysql-connection-and-iteration/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[How to: rotate wordpress posts into headline/feature status]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/88GXVJynzZ4/" />
		<id>http://themattreid.com/wordpress/?p=323</id>
		<updated>2010-08-25T20:20:00Z</updated>
		<published>2010-08-08T00:16:55Z</published>
		<category scheme="http://themattreid.com/wordpress" term="Scripts" /><category scheme="http://themattreid.com/wordpress" term="automation" /><category scheme="http://themattreid.com/wordpress" term="bash" /><category scheme="http://themattreid.com/wordpress" term="mysql" /><category scheme="http://themattreid.com/wordpress" term="Mysql server" /><category scheme="http://themattreid.com/wordpress" term="PHP" /><category scheme="http://themattreid.com/wordpress" term="scripting" /><category scheme="http://themattreid.com/wordpress" term="wordpress" />		<summary type="html"><![CDATA[<p>If you&#8217;re using the new <a href="http://www.themelab.com/2008/08/26/arthemia-wordpress-theme-review/" target="_blank">Arthemia theme</a> for WordPress you might notice that there are two areas of the theme that can have articles promoted to; namely Headline and Featured sections. This is controlled by category association. Basically you have a post and if you want it in the Headline area of the theme you attach the category &#8220;headline&#8221; to it, similarly for the featured section. Now, let&#8217;s say you don&#8217;t want to&#8230; <a href="http://themattreid.com/wordpress/2010/08/07/how-to-rotate-wordpress-posts-into-headlinefeature-status/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/08/07/how-to-rotate-wordpress-posts-into-headlinefeature-status/">&lt;p&gt;If you&amp;#8217;re using the new &lt;a href="http://www.themelab.com/2008/08/26/arthemia-wordpress-theme-review/" target="_blank"&gt;Arthemia theme&lt;/a&gt; for WordPress you might notice that there are two areas of the theme that can have articles promoted to; namely Headline and Featured sections. This is controlled by category association. Basically you have a post and if you want it in the Headline area of the theme you attach the category &amp;#8220;headline&amp;#8221; to it, similarly for the featured section. Now, let&amp;#8217;s say you don&amp;#8217;t want to manually change this all the time since it can be time consuming to promote posts to those categories if you want rotating content.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s a simple solution. In this bash script I connect to MySQL and remove the current associations from posts and then randomly choose posts to be promoted to the Headline and Featured categories. This can be modified for other ideas you might have involving categories/posts/randomized associations in WordPress. &lt;/p&gt;
&lt;p&gt;The queries contain IDs for the Headline and Featured categories. In my installation, which will be different than yours, has the Headline category as ID=&amp;#8217;103&amp;#8242; and Featured as ID=&amp;#8217;104&amp;#8242; &amp;#8211; replace as needed. I&amp;#8217;m also doing some matching (see the WHERE sections) so that I don&amp;#8217;t promote posts with certain IDs that are specific to the site for this script. You&amp;#8217;ll want to customize the queries as needed for your site. You can find the script here: &lt;a href="http://pastebin.com/1QqiM5rh"&gt;http://pastebin.com/1QqiM5rh&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/88GXVJynzZ4" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/08/07/how-to-rotate-wordpress-posts-into-headlinefeature-status/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/08/07/how-to-rotate-wordpress-posts-into-headlinefeature-status/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/08/07/how-to-rotate-wordpress-posts-into-headlinefeature-status/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[N900 &#8211; control all of your accounts with this script]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/rHV-KU5IBfQ/" />
		<id>http://themattreid.com/wordpress/?p=321</id>
		<updated>2010-07-27T22:42:27Z</updated>
		<published>2010-07-27T22:42:27Z</published>
		<category scheme="http://themattreid.com/wordpress" term="N900" /><category scheme="http://themattreid.com/wordpress" term="bash" /><category scheme="http://themattreid.com/wordpress" term="instant messenger" /><category scheme="http://themattreid.com/wordpress" term="linux" /><category scheme="http://themattreid.com/wordpress" term="mysql" /><category scheme="http://themattreid.com/wordpress" term="n900" /><category scheme="http://themattreid.com/wordpress" term="opensource" /><category scheme="http://themattreid.com/wordpress" term="Programming" /><category scheme="http://themattreid.com/wordpress" term="scripting" />		<summary type="html"><![CDATA[<p>If you own a Nokia N900 cellular device you might be interested in the ability to control all of your IM accounts from the command line. For those that do not know, the N900 runs Maemo Linux and is capable of running MySQL embedded if you so choose. Here&#8217;s a quick script I wrote to provide that functionality for IM accounts. It&#8217;s at the bottom of the page, called &#8220;im-connections&#8221;.</p>
<p>wiki: <a title="http://wiki.maemo.org/N900_Mission_Control#Set_all_SIP_accounts_to_online_or_offline" href="http://wiki.maemo.org/N900_Mission_Control#Set_all_SIP_accounts_to_online_or_offline" target="_blank">http://wiki.maemo.org/N900_Mission_Control#Set_all_SIP_accounts_to_online_or_offline</a><br />
pastebin: <a title="http://pastebin.com/qAC57E1N" href="http://pastebin.com/qAC57E1N" target="_blank">http://pastebin.com/qAC57E1N</a></p>
]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/07/27/n900-control-all-of-your-accounts-with-this-script/">&lt;p&gt;If you own a Nokia N900 cellular device you might be interested in the ability to control all of your IM accounts from the command line. For those that do not know, the N900 runs Maemo Linux and is capable of running MySQL embedded if you so choose. Here&amp;#8217;s a quick script I wrote to provide that functionality for IM accounts. It&amp;#8217;s at the bottom of the page, called &amp;#8220;im-connections&amp;#8221;.&lt;/p&gt;
&lt;p&gt;wiki: &lt;a title="http://wiki.maemo.org/N900_Mission_Control#Set_all_SIP_accounts_to_online_or_offline" href="http://wiki.maemo.org/N900_Mission_Control#Set_all_SIP_accounts_to_online_or_offline" target="_blank"&gt;http://wiki.maemo.org/N900_Mission_Control#Set_all_SIP_accounts_to_online_or_offline&lt;/a&gt;&lt;br /&gt;
pastebin: &lt;a title="http://pastebin.com/qAC57E1N" href="http://pastebin.com/qAC57E1N" target="_blank"&gt;http://pastebin.com/qAC57E1N&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/rHV-KU5IBfQ" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/07/27/n900-control-all-of-your-accounts-with-this-script/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/07/27/n900-control-all-of-your-accounts-with-this-script/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/07/27/n900-control-all-of-your-accounts-with-this-script/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[Benchmarking MySQL ACID performance with SysBench]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/wdSjtgOjSbc/" />
		<id>http://themattreid.com/wordpress/?p=315</id>
		<updated>2010-06-20T23:49:30Z</updated>
		<published>2010-06-20T23:40:50Z</published>
		<category scheme="http://themattreid.com/wordpress" term="Mysql server" /><category scheme="http://themattreid.com/wordpress" term="Scripts" /><category scheme="http://themattreid.com/wordpress" term="ACID" /><category scheme="http://themattreid.com/wordpress" term="commit" /><category scheme="http://themattreid.com/wordpress" term="database" /><category scheme="http://themattreid.com/wordpress" term="linux" /><category scheme="http://themattreid.com/wordpress" term="mysql" /><category scheme="http://themattreid.com/wordpress" term="performance" /><category scheme="http://themattreid.com/wordpress" term="relational" /><category scheme="http://themattreid.com/wordpress" term="server" /><category scheme="http://themattreid.com/wordpress" term="sysbench" /><category scheme="http://themattreid.com/wordpress" term="transactions" /><category scheme="http://themattreid.com/wordpress" term="tuning" />		<summary type="html"><![CDATA[<p>A couple of question I get a lot from MySQL customers is &#8220;how will this hardware upgrade improve my transactions per second (TPS)&#8221; and &#8220;what level of TPS will MySQL perform on this hardware if I&#8217;m running ACID settings?&#8221; Running sysbench against MySQL with different values for per-thread and global memory buffer sizes, ACID settings, and other settings gives me concrete values to bring to the customer to show the impact that more RAM, faster&#8230; <a href="http://themattreid.com/wordpress/2010/06/20/benchmarking-mysql-acid-performance-with-sysbench/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/06/20/benchmarking-mysql-acid-performance-with-sysbench/">&lt;p&gt;A couple of question I get a lot from MySQL customers is &amp;#8220;how will this hardware upgrade improve my transactions per second (TPS)&amp;#8221; and &amp;#8220;what level of TPS will MySQL perform on this hardware if I&amp;#8217;m running ACID settings?&amp;#8221; Running sysbench against MySQL with different values for per-thread and global memory buffer sizes, ACID settings, and other settings gives me concrete values to bring to the customer to show the impact that more RAM, faster CPUs, faster disks, or cnf changes have on the server. Here are some examples for a common question: &amp;#8220;If I&amp;#8217;m using full ACID settings vs non-ACID settings what performance am I going to get from this server?&amp;#8221;&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s find out by running sysbench with the following settings (most are self explanatory &amp;#8211; if not the man page can explain them):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;sysbench &amp;#8211;test=oltp &amp;#8211;db-driver=mysql &amp;#8211;oltp-table-size=1000000 &amp;#8211;mysql-engine-trx=yes &amp;#8211;oltp-test-mode=complex &amp;#8211;oltp-read-only=off &amp;#8211;oltp-dist-type=special &amp;#8211;max-requests=0 &amp;#8211;num-threads=8 &amp;#8211;max-time=120 &amp;#8211;init-rng=on run&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;MySQL Settings:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the first test MySQL is set to the following ACID related settings. This will give us results for TPS performance &lt;strong&gt;without&lt;/strong&gt; full ACID compliance &amp;#8211; very common settings on a server that is handling blogs, ad serving, general business websites, and other roles where full ACID is not required and performance is valued over the benefits of full ACID. These are important settings when we look at the difference in performance when we change to full ACID in the second test.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;innodb_flush_log_at_trx_commit = 0&lt;/li&gt;
&lt;li&gt;sync_binlog=0&lt;/li&gt;
&lt;li&gt;transaction-isolation=REPEATABLE-READ&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;System configuration and InnoDB buffer pool size:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;XEON E5345 Series 2.33ghz 8-core, 16GB RAM, Local SATA 7.2K disks&lt;/li&gt;
&lt;li&gt;innodb_buffer_pool_size = 10G&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Full result set from sysbench:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Summary OLTP test statistics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;queries performed:&lt;/li&gt;
&lt;li&gt;transactions:                        172426 (1436.83 per sec.)&lt;/li&gt;
&lt;li&gt;read/write requests:                 3276664 (27304.51 per sec.)&lt;/li&gt;
&lt;li&gt;other operations:                    344882 (2873.91 per sec.)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-style: normal;"&gt;&lt;strong&gt;Non-ACID results:&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="font-style: normal;"&gt;We can simplify the results by looking at the following TPS results for this non-ACID test:&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;&lt;strong&gt;&lt;/p&gt;
&lt;li&gt;&lt;span style="font-weight: normal;"&gt;transactions&lt;/span&gt;:                        172426 (1436.83 per sec.)&lt;/li&gt;
&lt;p&gt;&lt;/strong&gt;&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Full ACID results:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s go ahead and run the test again with different ACID settings. This will give us the TPS results for full ACID compliance:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;innodb_flush_log_at_trx_commit = 1&lt;/li&gt;
&lt;li&gt;sync_binlog=1&lt;/li&gt;
&lt;li&gt;transaction-isolation=REPEATABLE-READ&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We get the following results for TPS:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; transactions:                     &lt;strong&gt; 3197   (26.58 per sec.)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt; read/write requests:                 60743  (505.04 per sec.)&lt;/li&gt;
&lt;li&gt; other operations:                    6394   (53.16 per sec.)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Final Results:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So as you can see the difference between full ACID settings and not (on the same server with only those values on the cnf being changed) results in a huge difference in performance on this standard database server. We can now hand this data to the customer and they will know what impact the settings will have on their application&amp;#8217;s performance and what to expect when running full ACID vs non-ACID.&lt;/p&gt;
&lt;p&gt;More info on using sysbench here: http://sysbench.sourceforge.net&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/wdSjtgOjSbc" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/06/20/benchmarking-mysql-acid-performance-with-sysbench/#comments" thr:count="5" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/06/20/benchmarking-mysql-acid-performance-with-sysbench/feed/atom/" thr:count="5" />
		<thr:total>5</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/06/20/benchmarking-mysql-acid-performance-with-sysbench/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[Amazon now accepts hard drives for EC2 data transfer]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/ihvSNjOwdC8/" />
		<id>http://themattreid.com/wordpress/?p=312</id>
		<updated>2010-06-13T05:37:29Z</updated>
		<published>2010-06-13T05:37:29Z</published>
		<category scheme="http://themattreid.com/wordpress" term="The Cloud" /><category scheme="http://themattreid.com/wordpress" term="amazon" /><category scheme="http://themattreid.com/wordpress" term="ec2" /><category scheme="http://themattreid.com/wordpress" term="linux" /><category scheme="http://themattreid.com/wordpress" term="mysql" />		<summary type="html"><![CDATA[<p>I guess they got tired of people sending angry emails about data transfer fees:</p>
<p>&#8220;Amazon provides an online <a href="http://awsimportexport.s3.amazonaws.com/aws-import-export-calculator.html">calculator</a> to help customers decide whether it makes financial sense to ship data via mail rather than uploading over the Internet. You plug in the number of terabytes, devices, average file size, return shipping information and other factors, and find out how much the data transfer would cost via mail compared to standard Internet uploads.</p>
<p>For example,&#8230; <a href="http://themattreid.com/wordpress/2010/06/12/amazon-now-accepts-hard-drives-for-ec2-data-transfer/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/06/12/amazon-now-accepts-hard-drives-for-ec2-data-transfer/">&lt;p&gt;I guess they got tired of people sending angry emails about data transfer fees:&lt;/p&gt;
&lt;p&gt;&amp;#8220;Amazon provides an online &lt;a href="http://awsimportexport.s3.amazonaws.com/aws-import-export-calculator.html"&gt;calculator&lt;/a&gt; to help customers decide whether it makes financial sense to ship data via mail rather than uploading over the Internet. You plug in the number of terabytes, devices, average file size, return shipping information and other factors, and find out how much the data transfer would cost via mail compared to standard Internet uploads.&lt;/p&gt;
&lt;p&gt;For example, transferring data from a single device containing 2TB would require 26 hours of data loading time and cost $144.74. Uploading the same amount of data over the Internet would cost $204.80. The calculator does not show how long the Internet transfer would take.&amp;#8221;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.networkworld.com/news/2010/061010-amazon-cloud-fedex.html" href="http://www.networkworld.com/news/2010/061010-amazon-cloud-fedex.html" target="_blank"&gt;http://www.networkworld.com/news/2010/061010-amazon-cloud-fedex.html&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/ihvSNjOwdC8" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/06/12/amazon-now-accepts-hard-drives-for-ec2-data-transfer/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/06/12/amazon-now-accepts-hard-drives-for-ec2-data-transfer/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/06/12/amazon-now-accepts-hard-drives-for-ec2-data-transfer/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[How to install MongoDB on CentOS 5.4 / RHEL5 and interface with PHP 5]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/ojfLcR0YvLo/" />
		<id>http://themattreid.com/wordpress/?p=310</id>
		<updated>2010-05-11T20:53:14Z</updated>
		<published>2010-05-11T20:53:14Z</published>
		<category scheme="http://themattreid.com/wordpress" term="NoSQL" /><category scheme="http://themattreid.com/wordpress" term="centos" /><category scheme="http://themattreid.com/wordpress" term="database" /><category scheme="http://themattreid.com/wordpress" term="denormalized" /><category scheme="http://themattreid.com/wordpress" term="linux" /><category scheme="http://themattreid.com/wordpress" term="mongodb" /><category scheme="http://themattreid.com/wordpress" term="mysql" /><category scheme="http://themattreid.com/wordpress" term="normalization" /><category scheme="http://themattreid.com/wordpress" term="oodb" /><category scheme="http://themattreid.com/wordpress" term="redhat" /><category scheme="http://themattreid.com/wordpress" term="relational" /><category scheme="http://themattreid.com/wordpress" term="server" />		<summary type="html"><![CDATA[<p>If you&#8217;ve been reading up on the various NoSQL offerings and have wanted to try out one but don&#8217;t know how to get started, this is one of the easiest ways. I chose MongoDB for this example because I&#8217;m going to start using it for a project that needs features that MySQL isn&#8217;t as fast at: namely denormalized data with billions of rows. MongoDB has plenty of drivers for other scripting and high-level languages but&#8230; <a href="http://themattreid.com/wordpress/2010/05/11/how-to-install-mongodb-on-centos-5-4-rhel5-and-interface-with-php-5/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/05/11/how-to-install-mongodb-on-centos-5-4-rhel5-and-interface-with-php-5/">&lt;p&gt;If you&amp;#8217;ve been reading up on the various NoSQL offerings and have wanted to try out one but don&amp;#8217;t know how to get started, this is one of the easiest ways. I chose MongoDB for this example because I&amp;#8217;m going to start using it for a project that needs features that MySQL isn&amp;#8217;t as fast at: namely denormalized data with billions of rows. MongoDB has plenty of drivers for other scripting and high-level languages but I&amp;#8217;ll focus on the PHP driver today. If there is interest I can do a write up on Python usage later. This example is limited to CentOS, Fedora, and Redhat 5 servers that use the yum package management system. For more information you can reference their download page: &lt;a title="http://www.mongodb.org/display/DOCS/Downloads" href="http://www.mongodb.org/display/DOCS/Downloads" target="_blank"&gt;http://www.mongodb.org/display/DOCS/Downloads&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First install the prerequisites:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;sudo yum install gcc php php-pear&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then install the mogo php extension via pecl and add the extension to the ini file. (Increase the php.ini memory_limit to 32M if necessary). Then we restart apache to have the extension loaded. You can check your extensions via the phpinfo(); command in php.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;sudo pecl install mongo&lt;/li&gt;
&lt;li&gt;sudo echo &amp;#8220;extension=mongo.so&amp;#8221; &amp;gt;&amp;gt; /etc/php.ini&lt;/li&gt;
&lt;li&gt;sudo /etc/init.d/httpd restart&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the last part we add the yum repo and get the actual MongoDB server and client installed&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;cd /etc/yum.repos.d&lt;/li&gt;
&lt;li&gt;sudo emacs mongodb.10gen.repo&lt;/li&gt;
&lt;li&gt;paste in the following. This uses the repo for 64bit servers. See their download page for other architecture repo settings.&lt;/li&gt;
&lt;p&gt;&lt;code&gt;[10gen]&lt;br /&gt;
name=10gen Repository&lt;br /&gt;
baseurl=http://downloads.mongodb.org/distros/centos/5.4/os/x86_64/&lt;br /&gt;
gpgcheck=0&lt;/code&gt;&lt;/p&gt;
&lt;li&gt;sudo yum install mongo-stable-server&lt;/li&gt;
&lt;li&gt;sudo /etc/init.d/monod start&lt;/li&gt;
&lt;li&gt;chkconfig mongod on&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;#8217;s it, you&amp;#8217;re ready to start using Mongo! You can check the logfile to make sure things are running smoothly: &amp;#8220;sudo cat /var/log/mongo/mongod.log&amp;#8221;&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/ojfLcR0YvLo" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/05/11/how-to-install-mongodb-on-centos-5-4-rhel5-and-interface-with-php-5/#comments" thr:count="3" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/05/11/how-to-install-mongodb-on-centos-5-4-rhel5-and-interface-with-php-5/feed/atom/" thr:count="3" />
		<thr:total>3</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/05/11/how-to-install-mongodb-on-centos-5-4-rhel5-and-interface-with-php-5/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>admin</name>
						<uri>http://themattreid.com</uri>
					</author>
		<title type="html"><![CDATA[How to get colored output from &#8216;ls&#8217; on Solaris10]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Themattreid/~3/xVOzl5D7BTM/" />
		<id>http://themattreid.com/wordpress/?p=306</id>
		<updated>2010-04-27T01:04:17Z</updated>
		<published>2010-04-27T01:04:17Z</published>
		<category scheme="http://themattreid.com/wordpress" term="Mysql server" /><category scheme="http://themattreid.com/wordpress" term="Solaris" /><category scheme="http://themattreid.com/wordpress" term="open source" /><category scheme="http://themattreid.com/wordpress" term="bash" /><category scheme="http://themattreid.com/wordpress" term="cli" /><category scheme="http://themattreid.com/wordpress" term="command line" /><category scheme="http://themattreid.com/wordpress" term="database" /><category scheme="http://themattreid.com/wordpress" term="linux" /><category scheme="http://themattreid.com/wordpress" term="mysql" /><category scheme="http://themattreid.com/wordpress" term="opensolaris" /><category scheme="http://themattreid.com/wordpress" term="solars" /><category scheme="http://themattreid.com/wordpress" term="unix" />		<summary type="html"><![CDATA[<p>For all of those linux users out there that have moved over to, or tried out, Solaris10 or OpenSolaris because they heard the tales of how MySQL is faster on Solaris&#8230; or perhaps you wanted to learn how to use Sol10 for the great features of Zones or the ZFS filesystem? Regardless of why you&#8217;re on it you are probably wondering why Linux has colored output of filenames and directories but Solaris does not. The&#8230; <a href="http://themattreid.com/wordpress/2010/04/26/how-to-get-colored-output-from-ls-on-solaris10/" class="read_more">Read the rest</a></p>]]></summary>
		<content type="html" xml:base="http://themattreid.com/wordpress/2010/04/26/how-to-get-colored-output-from-ls-on-solaris10/">&lt;p&gt;For all of those linux users out there that have moved over to, or tried out, Solaris10 or OpenSolaris because they heard the tales of how MySQL is faster on Solaris&amp;#8230; or perhaps you wanted to learn how to use Sol10 for the great features of Zones or the ZFS filesystem? Regardless of why you&amp;#8217;re on it you are probably wondering why Linux has colored output of filenames and directories but Solaris does not. The question of &amp;#8216;why?&amp;#8217; isn&amp;#8217;t important, but how to enable colors is. It&amp;#8217;s very simple, and here&amp;#8217;s how I fixed it. This is a result of digging through multiple semi-related links on Google. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download all packages from SunFreeware.com
&lt;ul&gt;
&lt;li&gt;dependency: libintl-3.4.0-sol10-x86-local&lt;/li&gt;
&lt;li&gt;dependency: libiconv-1.13.1-sol10-x86-local&lt;/li&gt;
&lt;li&gt;dependency: gmp-4.2.1-sol10-x86-local&lt;/li&gt;
&lt;li&gt;dependency: gcc-3.4.6-sol10-x86-local or libgcc-3.4.6-sol10-x86-local depending on your system needs&lt;/li&gt;
&lt;li&gt;coreutils-8.4-sol10-x86-local&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Install &amp;#8216;coreutils&amp;#8217; dependency packages using the command &amp;#8220;pkgadd -d [package_name]&lt;/li&gt;
&lt;li&gt;Install &amp;#8216;coreutils&amp;#8217; packages using the command &amp;#8220;pkgadd -d coreutils-8.4-sol10-x86-local&lt;/li&gt;
&lt;li&gt;Enable color aliases in your rc file: &amp;#8220;alias ls=&amp;#8217;/usr/local/bin/ls &amp;#8211;color=auto&amp;#8217;&amp;#8221;&lt;/li&gt;
&lt;/ol&gt;
&lt;img src="http://feeds.feedburner.com/~r/Themattreid/~4/xVOzl5D7BTM" height="1" width="1"/&gt;</content>
		<link rel="replies" type="text/html" href="http://themattreid.com/wordpress/2010/04/26/how-to-get-colored-output-from-ls-on-solaris10/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://themattreid.com/wordpress/2010/04/26/how-to-get-colored-output-from-ls-on-solaris10/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://themattreid.com/wordpress/2010/04/26/how-to-get-colored-output-from-ls-on-solaris10/</feedburner:origLink></entry>
	</feed>
