Thursday, May 28, 2009

Embedded MySQL = libmysqld - Where is it?? I want to download it??

I have seen this question more than once, and I have answered it more than once, but let me get you the facts here, so you know what to look for:

First, Embedded MySQL isn't necessarily the same thing as libmysqld. Libmysqld is the technically embedded MySQL server in a library, in your application. As far as the MySQL website goes though, this is not necessarily how it works. On the website, Embedded MySQL refers to any kind of embedding of MySQL in an application, be it the "normal" MYSQL Server that has been embedded, or be it libmysqld.

This is confusing, and unnecessary, but I have failed to fix this, although I have tried, and this convention has been in place for so long now, that it is difficult to change (also, it means I can keep my job, as I have to explain this to people frequently. Not the most fun of jobs though).

For anyone wanting to embed MySQL and hasn't used MySQL before, maybe you have Oracle or SQL Server or such experiences, embedding these products with an application is actually rather difficult. There are loads of files, registers to update and such-and-such. As for the MySQL server though, this is not the case. MySQL is dead easy to embed, even the full Server, although there is even less to worry about when using libmysqld.

Libmysqld, as you might know, is a "server in a library" implementation of MySQL, which has a few limitations, but which also has surprisingly low overhead. Have a look in my blog for more posts on libmysqld, or more specifically the post on my libmysqld demo application, available on sourceforge.

So hopefully I have cleared that one up. And then, if we assume that it is libmysqld is what you want, they I guess you want to know where to download libmysqld. And the answer is that you can't. There is no separate download for libmysqld, rather it is included with the usually MySQL Server download. And note that there is no libmysqld with 5.0, neither as a separate download, nor as part of the server download. You have to go with 4.1 or 5.1 to get hold of libmysqld.

So to find libmysqld, you download the appropriate version of the MySQL Server, and then you find libmysqld somewhere there. On Linux, it's in the lib subdirectory, on Windows, it's in the Embedded subdirectory.

So, one last comment on this subject then. Why is there not a separate libmsyqld download? Well, one reason is that, even though libmysqld is a self contained MySQL Server in a library, you still need a few more things, like the MySQL C/C++ includefiles to compile you application and at least one of the MySQL language files, named errmsg.sys, to be able to run the application. Usually, at least during development, you want more things, such as some the MySQL utilities. So having to download the whole MySQL Server, including utilities etc, might not be such a bad idea after all.

But what IS a distinctly bad idea is how we confuse Embedded MySQL with libmysqld, but as I said, it's difficult to change now, and it keeps me on the job (if that last argument is a good thing or not, well I leave that to judge, but at least it means I can have a few beers at the end of the day).


Wednesday, May 27, 2009

MySQL 5.4 testing - Failure and a W/O

I had this idea around 5.4. It is meant to scale better on multi-core machines compared to, say, standard 5.1. This has been proven also it seems. 5.4 is still in Beta, but testing has shown that scalability is definitively better.

What I wanted to know was how well 5.4 would work on a lower spec box compared to 5.1. One reason for me wanting to test this is that I am currently in my summer house, and I have no multi-core 64-bit machines around. All I have in terms of Linux boxes is an old Dell Laptop with Gentoo on it, all this will as similar setup as possible between 5.1 and 5.4.

So, I download 5.4 sources, as there are no 32-bit Linux binaries yet, and I do a simple configure and make. And.. I fail. Out of the box, some of the inline optimizations in innodb (the config I built with was max-no-ndb) will screw up gcc when using -O3 optimization (OK, I admit, I'm not 100% sure that this is the cause, but it sure looks like it, and some googling seems to confirm it, but I'm not a compiler engineer, so who knows).

So today, when I was planning to do some benchmarking and some other fun things, I tried to track this one down, and I did find a W/O for this issue, which is to configure with CFLAGS=-O2, i.e.:
./configure --with-plugins=max-no-ndb CFLAGS="-O2"
This will actually do the trick. And once I figured that out, I had to report it as a bug (#45131) and try with a few different compilers.

I did an emerge on gcc for my gentoo, and got gcc 4.1.2 instead of 4.1.1, and had the same problem. I also tested on another box running SuSE and gcc 3.3.1, and with the same problem. But as I said, at least there is a fix.

Tomorrow, I might do the actual low-end 32-bit machine performance test, I'll keep you posted.


Wednesday, May 13, 2009

Is it just me who want to search? Is google dead? Or?

I really like the idea of Planet MySQL. Lots of good information in one place, for reference and for news and what have you not. But why, in heavens name, can I not search?

It's not that I cannot use Google, if needed (and if you do, search for site:, not for, although both URLs gets you to Planet MySQL, the latter will find.. Nothing (the first is the "real" URL also).

Maybe, if I could ask for something more, would it be possible to have a means of categorizing all the posts, at times, there is just too much stuff going on. I don't think anyone can keep up with and read all the posts. Even myself I blog on different aspects of MySQL and OSS. This would surely add a level of organization. How this would work, I don't know for sure, but it would be nice.

And also, maybe just a means of looking at the blog overview in some different ways, like showing just the subject, but showing a few more per page.

Feeling picky and groovy

Saturday, May 9, 2009

Linux (in this case Fedora) is still not what I would call "user friendly"

OK, so it happened, I knew it would. The PSU in my main desktop Linux box broke down (it has been noisy and unreliable lately). It was completely dead. I subsequently went out to get a new one, and once home, started the process of removing the old PSU from the case, which was an Antec Sonata II. This is not a bad case, but I was surprised that the PSU had broken down, as this was not a low-end PSU (it was an acclaimed Hiper PSU. Next time I'll go cheap again).

Now, getting the old Hiper out of the Sonata was turned more difficult than I expected, as the CPU cooler was in teh way of getting the PSU out. I tried any trick I could think of, but in the end, I had to remove the CPU cooler. That finished, I could now replace the PSU with the new (and cheap 500W noname). That done, I now had to replace the CPU cooler. Without looking (big mistake) I just placed the CPU cooler on the CPU and fastened it (with screws, this was an AMD 754 socket CPU).

Booting time. Nothing happened, indications of CPU problems, and nothing comes up on the screen. "Maybe something went amiss when I mounted the CPU cooler" I think. So I remove the CPU cooler, and now I see what I had missed last time: The CPU is fixed to the CPU cooler with thermal grease, and when I remounted the CPU cooler last, I just pushed the whole thing, CPU and all, onto the socket. Needless to say, CPU pins were bent and it was a mess. I tried to fix it, but gave up.

So, here is the fun part then. This was an old mobo and CPU anyway, so I decided for a major upgrade. I went out and got myself a new Asus mobo and a Quad-core AMD Phenom and 4 new fresh gigs of RAM. Oh, how sweet it is!

So, I came home, changed the Mobo and all that, and remounted the disks and what have you. This was a DeLuxe Mobo with all bells and whistles. Once HW is up again, I try booting. This puppy is running Fedora 6 right now (I know that is a bit old, but it has worked so far).

When booting Linux now, grub gives me errors on missing partitions (LogVol etc. yes, I am using LVM), a missing target to copy to etc. Yes, I sort-of understand what is happening, the LVM is dead, and as I have LVM on my boot partition, booting fails. But why?

Linux, in the shape of Grub, gives me all sorts of errors, that would make many users scared stiff ("kernel panic" for example). I am sort of used to this though, and although not being a Linux guru, I can usually figure things out, given time.

In this case, Grub had all sorts of problems with disk partitions, LVM, "/dev no such file" etc. I started Googling on one of my other machines. At first I found nothing. But then I added "motherboard" to my search. Frankly, although it was the Mobo that was changed, I wasn't expecting this to be the issue, and Grub said nothing of the kind, rather Grub had problems with disks and LVM and stuff.

But actually, this WAS the problem. This is how it works: When you install Fedora (I don't know if other Linux distros do this, but if they do, this is stupid) it collects a list of drivers needed to boot the system and makes those drivers, and only those, available at boot-time. Someone it trying to be economical here or something. In this case, the SATA device was different, as I had a new mobo. Once I had booted into rescue mode, fixed up grub.conf and rebooted, things were OK. What annoys me here though are three things:
  1. Why can't Grub give me an error message on a missing driver for booting? Hey, it KNOW this is needed, right. So why can't it tell me that, instead of letting the boot process spew out numerous weirdo messages, that has very little do do with the real problem? The reason is started booting at all I guess is because it handles the MBR as IDE.
  2. Why doesn't Fedora (or any other Linux distro, I don't know), add a few more than just the basic SATA driver. In this case, the new Mobo used AHCI, which is used all over the place these days. The old one had a VIA SATA-I interface.
  3. Now, why can't Grub be smart enough to allow itself to test for drivers, and allow me to modify it? Just give me a warning at boot time if a required driver is missing, and allow me to load another one? Or even allow me to ask Grub to test another one? As for myself, I do not mind booting in rescue mode and editing a file with vi and then issue a bunch of weirdo commands, but I don't think the general population would buy into this.
All this said, I don't hate Linux. Fact is, I don't even dislike it. But I don't dislike or "hate" Windows or OS/X or Solaris either. (Frankly, my list of things I hate contains much more despicable things that stuff that deals with computers at all). But I have done many hardware upgrades of many kinds on my Windows boxes over the years, and nearly always it has worked out OK (when it hasn't, it was usually the driver in question being bad, and not the way Windows handles it).

Linux is cool, and my box is running fine now, faster than ever. But this took a fair while to figure out. For a while, I contemplated upgrading to Fedora 10, so I downloaded a Fedora 10 live CD. I booted into this, and tried to make up upgrade my Fedora 6 installation. It refused to do do. It didn't like my partitions, and it insisted on having to reformat my partitions if I installed on them, despite these being perfectly normal ext3 on LVM2. I could mount the partitions, in the usual manner from the commandline, but the installer didn't like it. I don't know why.

And it might be Fedora that is the problem here. I wouldn't be surprised, actually. The reason I have Fedora on this box is that I try to have a few different Linuxes running, and I already have SuSE, Debian, Gentoo and Ubuntu installed on other machines.

Packing up the screwdrivers, soldering irons, wrenches and other HW stuff to get back to proper software engineering again