Categories
How-To TechBiz

Upgrading to MySQL 5.1: I Love Built-in Table Partitioning!

If you upgrade to MySQL 5.1 (which is still in beta), you will love the performance boost you get over the partitioning that you’re probably doing on the scripting side because of what Yahoo told you. I think improving the “front-end” is great and all, but if you look at the recent benchmarks below run on MySQL 5.1, you’ll see that Yahoo cannot escape the reality of backend speed.

At this week’s Web 2.0 Expo, Yahoo is telling folks to make things work faster on the front end. It’s a great sound-byte, but stupid advice.

If you upgrade to MySQL 5.1 and use its built-in table partitioning, I’m betting that you’ll see a speed boost in selects of up 300%.

Are you ready to Benchmark? I’m assuming that you’ve done a PHP / MySQL install before.

Part I: Installation of MySQL 5.1

  • Download the beta version of MySQL 5.1
  • Back up your mysql database.
  • DO NOT RUN mysql_upgrade. As of this blog posting, it does not work. You wil lock yourself out of your database and go through a painful rebuild process.
  • Install MySQL 5.1 fresh as a new install. If you’re me and want to use partitioning this means: ./configure –prefix=/usr/local/mysql –with-ssl –with-partition ; make ; make install
  • Restore the backed up mysql database.
  • Get your database up and running again.

Part II: Get benchmarking scripts up and running

  • I used PHP 5, and PHP Pear’s Benchmark package.
  • Download the Partition Benchmarks scripts.
  • 3 types of tables are benchmarked: partitioned by software (i.e. Yahoo’s way and how a lot of folks did it before MySQL 5.1), partitioned by MySQL, and not partitioned at all. The script is called build_tables.php . It works on the command line like this: php build_tables.php 10000 5, where 10000 is the number of total rows you’re expecting, and 5 is the number of table partitions.
  • After the tables are built you can now test a select using the testDao.php script by typing: php testDao.php

The results I got on a 1 Ghz PowerPC G4 running Mac OS X 10.4.9 are interesting.

First I built a 5 partitioned tables spanning 10000 rows:
shell> php build_tables.php 10000 5

Then I ran the tests on the 3 partition types: software, mysql, and non-partitioned:
shell> php testDao.php

Elapsed time between Start and Test_Code_Partition: 0.059307
Elapsed time between Test_Code_Partition and DB_Partition: 0.005882
Elapsed time between DB_Partition and No_Partition: 0.003694
------------------------------------------------------------------
marker                time index            ex time         perct   
------------------------------------------------------------------
Start                 1176964205.32067900   -                0.00%
------------------------------------------------------------------
Test_Code_Partition   1176964205.37998600   0.059307        85.83%
------------------------------------------------------------------
DB_Partition          1176964205.38586800   0.005882         8.51%
------------------------------------------------------------------
No_Partition          1176964205.38956200   0.003694         5.35%
------------------------------------------------------------------
Stop                  1176964205.38978100   0.000219         0.32%
------------------------------------------------------------------
total                 -                     0.069102       100.00%
------------------------------------------------------------------

The non-partitioned set up ran the fastest — but that’s no surprise b/c the number of rows aren’t large enough to take advantage of partitioning.

Built-in Partitioning came in 2nd.

PHP partitioning, or software partitioning came a distant 3rd.

So what are you waiting for????

If you need that urgent speed boost in your database-driven web application, get MySQL 5.1 now.

Categories
TechBiz

Youtube Lies

Do a search for your favorite tag in youtube. If it’s Britney Spears, then youtube will tell you that they’ve got 19,400 plus videos on Britney. I got to the 1000th Britney Spear video by skipping all 999 of them on this search result page.

What happens when you try to go to the 1001st video?

You get the error below:

No 1001st Video

Guess what? Youtube’s not alone. Flickr does it too. Can anyone guess their limit?

Categories
TechBiz

Social Software: Are you really interacting with people?

My answer to this question is, “No.” You are not interacting with people. You are interacting with their simulacra…

Who did you hang out with the most this week? Honestly, it was my co-worker from India. I sat across from him and went over how the XML interface worked for shipping and receiving computer hardware.

Yet, the very people I look forward to hanging out with the most are the ones whose simulacra I am most acquainted with.

Shouldn’t I be hanging out with my co-worker who has more reality than the images that flit across my screen?

I’ve done so much on the Internet, that I explain life (the real) in terms of technology (the unreal). For a lot of techies, this is the case. Are you a techie and bothered by this?

Categories
TechBiz

A Real Life Truman Show: Justin.tv

If you liked The Truman Show, then you’ll like Justin.tv, a real life version of the movie.

If you could watch anyone’s life 24/7, whose life would it be?

Categories
How-To

taking pics every hour with isightcapture

I just started using isightcapture, a command-line tool for creating pics from your isight on Mac OS X. It’s pretty easy to use.

Save isightcapture to your bin.

Type isightcapture name_of_your_pic.jpg and voila, a pick of you.
You can also crontab it with

5 * * * * isightcapture $HOME/Pictures/icons/crontab.jpg

Categories
How-To

I digg leet Mac OS X command line stuff

Hey, did you know you can put your favorite dashboard widget on your desktop without having to hit F12?

Check out the Top 15 hidden terminal commands for Mac OS X.

It is eeee-l33t.

Categories
How-To

Dear Lazy Web: How do I Send Emails from Non-Resolvable Servers?

I’m trying to use php’s mail command to send emails to myself.

Unfortunately, the logs bring this up:

553 5.1.8 …

Domain of sender address jbarcelona@sovrainshrine does not exist

(at 16 Mar 2007 22:31:09(GMT))

IP:207.106.84.164

Which makes sense b/c I’m behind a firewall and the server I’m using is only resolvable from behind my firewall.

So what information do I need to put in the header to make this work?

Yes, I’ve read www.php.net/mail but the examples just don’t work.

UPDATE: 3/21/2007

I just downloaded PHP Mailer, and it’s been working like a charm.

Categories
How-To TechBiz

How I Got Into SxSW Parties

The advice here goes beyond plain ol’ networking skills and a winning smile.

1) Talk to promoters. I learned this one from Jakob Heuser who talked to a promoter that got us into the Facebook party which was invite only. Jakob also knew how many people he wanted to get into the party in addition to himself, and so he asked for additional invites. SxSW wins notoriety for having way too many female promoters leading to parties with way too many dudes in an already way too many dude market. Well, it helps having my winning smile to sort me out from the rest.

Facebook Invite Scored by Jakob

2) Get on the VIP list of every club that you think will be hosting a cool party. You do this by visiting their website, and asking to be put on their VIP list. You also do this by calling the venue.

3) Once you’ve done step two, you need to show up the evening before. Talk to the folks who work the door. Ask who is working the door tomorrow. I did steps 2 and 3 the day before South by Southwest started. The result: Fun, fun, fun and a stack of business cards that I’ve been entering into my address book for the past 2 hours. Next time I’m at Fry’s, I’m getting a card scanner

Now go out there and get to some parties.

Categories
TechBiz

What’s missing? CPAN for JavaScript

I’ve been messing around with Perl in-between conferences at SxSW. What’s delighted me is how little I have to code because of CPAN, an archive of Perl Modules.

In order to write a simple RSS aggregator all I had to do was:
1) Create a class for fetching and saving the RSS.
2) Use a Perl module with web client functionality. (LWP::Simple)
3) Use a Perl module that can parse RSS. (XML::RSS::Parser)

my $lostdogs = Fetcher->new();
$lostdogs->feed("http://sfbay.craigslist.org/search/ccc/nby?query=lost%20dog&fo
rmat=rss");
$lostdogs->getfeed();
$lostdogs->savefeed('lostdogs.rss');

Now what if there was something like CPAN for JavaScript? Wouldn’t it make building all those AJAX apps easier? You wouldn’t have to be committed to either Dojo or YUI or Prototype.

Categories
TechBiz

Learning about Microformats

Jakob Heuser introduced me to Tantek and Matthew Levine. My conversation went something like this:

Me: How’s it going with hiring PHP guys?
Tantek: We’re always hiring great talent.
Me: Really?
Tantek: Do you know about microformats?
Me: No.

At this point Tantek turned away from me and our conversation ended.

But Matthew Levine jumped in to help out by asking, “Do you have a website?”

Me: Yes
Matthew: Let’s add a microformat to it right now.

In less than half an hour we geeked out the right sort of microformat for my website and put it up on my contacts page.

It’s because of helpful folks like Matthew that SxSW is so enjoyable.

If you don’t know about microformats, I will not turn my back to you, and will no doubt help you out in the same way that Matthew did.