Archive for November, 2008

Debugging mysql on the wire

Earlier today i was struggling with a mysql replication that didn’t work and while banging my head at that problem i realized that maybe i would help to see what the master actually sends to the slave. Well i decided to redo my whole replication setup and see if that would help and it did.

But the idea of actually debugging what was sent on the wire still lurked around in my head so i decided to at least write some thing about it here. just in case someone else would like to do the same thing.

And it’s really easy to do. If you don’t have wireshark, install wireshark like this:

# cd /usr/ports/net/wireshark

# make install

So now when we have the tool here is how to use it for debugging mysql by listening to what actually get transmitted to the server:

# tshark -T text -V -f ‘dst port 3306′ | grep -i Statement: | cut -b25-

Now just lean back and watch the output looking like this:

select address from pools where citypool = ‘sth.globalns.openpeers.net’ \n
select address from pools where citypool = ‘sth.globalns.openpeers.net’\n
select address from pools where citypool = ‘lon.globalns.openpeers.net’ \n
select address from pools where citypool = ‘lon.globalns.openpeers.net’\n
select address from pools where citypool = ‘none.globalns.openpeers.net’ \n
select enabled from site where name = ‘www’ and site = ‘arnold’ and domain =’globalns.openpeers.net’ and enabled = 1\n
select pool from which where nexthop = ’83.142.224.2′ and enabled = ’1′\n

But hey! Whats this it looks like i’m sending identical mysql queries!

Thats right while writing this entry i noticed a flaw in my program! That was very easy to code in a better way. So writing this post  helped me to fix a flaw that i didn’t even no existed.

Btw. by using port replication in your switch you can divert all traffic for the sql server to another box analyzing the traffic. Save load on the client or server, or enables you  to debug a multi client setup.

someone elses inbox showed up in facebook

Well i guess you aren’t going to belive me this time…

But just a couple of moments ago i ran into a strange facebook bug, i was looking at someone elses inbox!

Just out of the blue when i returned to my inbox after browsing a friends profile, my facebook page was in Turkish and i was looking at someone elses inbox. This is the moment when i should have done a screen dump, but unfortunatly i got so stunned that that thought didn’t strike me. Instead i was fascinated by the fact that slowly (when looking around) the user interface started to go back to English bit by bit. I also noticed that the applications installed was applications i had never seen before. And suddenly the whole page was in English and looking normal again.

No i’m not on drugs, and i’m not drunk. Actually if this would have happened yesterday while drinking a glass of Tuzemska i would have stopped drinking and gone directly to bed…

Anyone else who have noticed this strange glitch? Please comment below, and preferable include a link if you managed to get a screen dump or have a link to any more information!

Btw. Im running Mozilla Firefox 3.0a2 under FreeBSD 7.0-STABLE

how to speed up downloading ports

Well i guess you all sometime have noticed that the ports system isn’t so smart about which ftp server to start downloading distributions from. Quite often i have noticed that the multi megabyte file i’m downloading comes from japan. Not optimal at all…

Well today Wesley Shields pointed out  on freebsd-ports  that there is a solution to this problem. There is a port under ports-mgmt called fastest_sites that is neat to have. fastest_sites sorts the MASTER_SITE definitions depending on the round-trip time for the tcp-handshake. (ping isn’t really useful since it could be blocked out by firewall rules)

So lets go ahead and install this nice tool:

# cd /usr/ports/ports-mgmt/fastest_sites

# make install

Now you have installed the fastest_sites program, so run it to generate the sorted list of master sites:

# fastest_sites > /usr/local/etc/ports_sites.conf &

This step will take some time, there is a lot of sites to probe… While waiting add the following line to /etc/make.conf:

.include "/usr/local/etc/ports_sites.conf"

Done!

Now each time you install a port make will choose from the list sorted after temporal proximity instead of just guessing randomly.

Quite often this makes a great difference! Especially if you happen to be close to one of the listed master sites.

Naturally master sites come and go, but also the network load and topology might change so run fastest_ports now and then to keep your own database up to date.

The orginal site for this application can be found here at Jodan Sissel’s site semicomplete.

The liberati is here

So finally we in the Liberati have published our five point declaration defining what the Liberati is and our view of the future of liberal politics in Sweden.

The Liberati has allready stired up a loot of feelings in the Swedish blog sphere. Mostly a lot of nit picking regarding the name and the persons engaged. But also over the fact that the core of Liberati has some strict criteria for who will be part of it. (The core that is or you might call it the steering committee.)  But come on, we are starting a new movement in Swedish politics and for this to become effective we need a tight group that meets frequently and discusses the core aspects that Liberati will be focused on.  It’s just not doable without some steering and especially not if there is to many chefs stiring the same pot.

And there is also a lot of people sceptical to the fact that the founder is the Swedish artist and philosopher Alexander Bard. People being sceptical due to this don’t really know what they are talking about. I have rarely meet anyone so bright and motivated as Alexander, and mostly everything he have touched he has excelled with. I’m totally confident that the same will happen with the Liberati.

So please have a look at our five point declaration above and give me some feedback!

Update: I guess i should inform you that the liberati homepage is now officially launced.