Archive for July, 2007

MySQL Woes

Tuesday, July 31st, 2007

I was having problems with slow queries last night and I noticed that MySQL, even with two other CPUs available, just stuck to one processor. I did a little googling and found out that MySQL is not that multi-threaded.

I’m currently working with about 70 instances, all versions, different configs and settings, different loads. (Sometimes more than 7000qps)

Basically, here are the facts:

MySQL relies on NTPL or PTHREADS to handle it’s concurrent processing, and this in itself is a design flaw. Real transactional databases use multiple processes and multiple threads within those processes. Using linux threads can push a small percentage of the load to other processors/cores but it’s not anywhere near what a real multi-process application can do

If you’re lucky, your top will have the “H” option which shows threads as fake separate processes. If you’ve got enough connections per second, you’ll see mysql throw off a few threads to a different processor, but your MPSTAT will show that only one of the cores is doing most of the work (based on interupts per second, which is more accurate than load average or any other variable in top) In fact, the majority of the load on the other cores comes from the operating system services (kjournald, syslogd, …)

MySQL was designed as a simple single-process database app that sits on the same server as php and apache, so if you’re running a typical LAMP blog site or zencart on one server, this is more than enough

If you install PostgreSQL, Oracle, Sybase, basically any real database application, you’ll see dramatic difference in how the workload is distributed. The CPU cores do about the same number of interupts per second

I’ve tested mysql on every platform, and the outcome is always the same. A Sun T2000 box with 32 cores, regardless of mysql config, thread library, or version, will show activity on only one core from MySQL (even with hundreds of open connections)

Anything more than a single core CPU is completely useless for a database server running mysql. If you want to spend money on what really matters, get a decent fiber storage array with a fast controller

The conclusion: If you want to leverage multiple CPUs on a server running nothing but a database application, don’t use MySQL. Otherwise get a single core pizzabox and a fast disk controller and you’re all set

If this is true, can I setup another instance of MySQL on the same machine and have it replicate?

I listened to the July 21st episode of FLOSS Weekly the other night and the topic was Postgresql. This is exactly what Josh Berkus was talking about. I should try playing with Postgresql again. Table partitioning sounds like a huge lifesaver and I could sure use the extra data types.

Google, on the other hand, uses MySQL in a couple of apps. They use a huge cluster of mid-range machines with large memory. I’m after utilizing the other available CPUs.

Links

Bookmarks for 2007.07.30

Monday, July 30th, 2007

Lazy Sunday

Sunday, July 29th, 2007

Spent half of my afternoon on YouTube and found lots of cool stuff. It’s really annoying that YouTube can get you hooked for hours. I found a couple of stuff about my favorite games. It would be a shame to keep them all to myself so here you go.

Thriller Fireworks and Laser Show with RCT3 - I’m soooo playing this game again.

GTA: San Andreas Multiplayer - Wow, they got it working! I’m impressed. Love the last part on this clip where they all start throwing pineapple grenades at each other.

Grand Theft Auto 4 trailers - This might be the only reason to buy a PS3 or an Xbox.

GTA4 Trailer Spoof - It’s not even out yet. Ha ha!

SimCity Societies - Huge disappointment.

Since I don’t have an interesting social life, this makes me really depressed that I don’t have a working gaming machine.

Philippines Yo!

Sunday, July 29th, 2007

Got amused by this.

Hot or not? Posers or freedom of expression? He ain’t no gangsta daw so don’t go hatin’.

Bookmarks for 2007.07.25

Wednesday, July 25th, 2007

Survivors

Tuesday, July 24th, 2007

Sometimes, you’d hear funny people argue over the radios at Urban Dead.

“You do know that Over and Out is a giant Contradiction?”
“Over means you are finished and expect a reply.”
“Out means you are finished and do not want a reply.”
“Out and”
“over..out”
“Does that english lesson even matter? She’s right you know.”
“I just can not stand people who can not use radios properly.”
“How can these guys prove that RHVP is responsible? And to”
“And it is a lesson in RATEL, not English.”
“think I almost sent out a request to bounty hunters! In case”
“your wondering, I’m Doctor Mad Scientist (id=870129)”
“and I’m sure it’s the end of the world if no one points out”
“that’s it RATEL… (friggin Marine-wanker fanboy wannabe.)”
“One, I am not Amerikan. Two, The USMC Sucks.”

By the way, you can’t tell who’s broadcasting. Just from where and what frequency. Can’t wait for Lost to resume.

Lessons from the weekend

Tuesday, July 24th, 2007

In chronological order:

  1. Finally learned how to install packages in FreeBSD. I’m getting the hang of it and I’m sorta starting to like it.
  2. “Cover your ass” — backup and backup backups.
  3. Got to triple boot CEntOS, Debian and FreeBSD. Did this for one whole day (yes, I am that dense).
  4. FreeBSD’s console has the coolest screensavers!
  5. CEntOS takes a lot of time and CDs to install. Not to mention that Debian and FreeBSD are more advanced.
  6. Debian is sooooo sexy.
  7. When reformatting partitions, don’t forget to edit fstab.
  8. In network interface configuration, NETWORK != GATEWAY (D’oh! Isn’t that obvious already?)

I’m pretty sure you didn’t notice but my blog was down yesterday and the other day. I forgot that I jumbled up the partitions of the server this blog is on. That was months ago and I didn’t get to update fstab. I reformatted a partition that was mounted as /swap but I had to reboot the server to use the new swap partition. It was live so I couldn’t just reboot it.

Days, weeks and months passed by until I forgot about it. A power maintenance was scheduled last Sunday and the servers were set to go down. Actually, I forgot about that too. I was all set to do some hacking when it went down.

It was 3 hours later when the other servers went up. I thought somebody forgot to turn on this server. I waited for a couple more hours. Sent text messages, emails then finally got bored and decided to make some calls.

I finally got in touch with somebody within reach of the rack. I was told that it’s running but it goes to recovery mode. I was told that an indicator with an exclamation mark is lit. I actually thought that the server was left with two drives and one of them was dead. I have backups of my stuff but most of them are on the same machine. It scared the hell out of me. When will I learn my lesson?

When I got there last night, it turned out that it couldn’t mount one of the partitions. I’m wondering if it should’ve been designed to handle the error and continue mounting the rest of the partitions. The warning indicator is for the redundant power supply. They said something about the cable about being something.

In very rare idle moments, I wonder and think if I want to be a sysad. It’s thrilling and there’s a lot of suspense [at the very first days] and you don’t have to think so much. Plus I love watching LEDs blink. Sysad or sysdev? Hmmmm…

Bookmarks for 2007.07.21

Saturday, July 21st, 2007

Bad Apples (Cont’d)

Friday, July 20th, 2007

First off, iPodLinux won’t install on my iPod. It just keeps failing. I’m heart broken. Second, can’t Apple screw the fancy design for practical use? I always have a hard time unplugging the USB cable.

I’m still not in the mood to upload my songs. I’m putting up with Apache’s indexing until I get MythTV installed. My GNUMP3d installation is messed up. The last 5 seconds of the tracks are clipped off. I’d try to hack it but I’m no PERL genius.

The Red Telephone

Tuesday, July 17th, 2007

Globelines Broadband/Innove Technical Support Hotline: (02) 7301357

Just called today for a follow up on our bill adjustment. I found out that bill adjustments takes two months to reflect (What? That’s messed up.). I noticed that they stopped sending session logs too. Currently, I’m trading off a little instability to bandwidth.

I wish that they have a plan where certain websites or IP address have higher bandwidth limits (some sort of white list). That would be awesome.