Archive for February 2012

Notes from Granada & Barcelona, Spain

This is my first time in Spain and I’m happy to say I’ve visited Granada and Barcelona all in one. Some quick notes:

  • This is an EU nation, yet you’ll have to fill in some kind of landing form if you’re not an EU national. They don’t ask you to retain the departure card, preferring instead to keep the whole sheet. It proved no issue leaving the country either.
  • Churros are meant to be eaten with thick hot chocolate. No wonder people gave me funny looks when I just ate it as is.
  • The Spanish are friendly. A fairly good looking person just sat across me on my table at breakfast one morning. Upon looking up only did she realize she should have asked first.
  • The cuisine is awesome. Lots of little dishes. Olives stuffed with anchovies in brine. Fried green peppers. Paella served with an obligatory sangria. The list goes on and on. Sometimes though I found some of the tapas a little too salty for my liking.
  • Getting an English-language newspaper is a challenge in Granada, on Spanair, in the Barcelona airport lounges. In Barcelona though, international hotels and the Ramblas area will serve up some English magazines as well as the Financial Times.
  • Siesta is something I cannot fathom/get used to. Yes, it is a significantly lengthy lunch hour, but I guess its something cultural.
  • Speaking English is a challenge. Hotel staff too find it difficult to understand sometimes. And outside of Barcelona/Madrid, it’s going to be hard to find an international chain, so be prepared to speak slowly and explain yourself clearly.
  • Pretty much everything (retail) is closed on Sunday in Barcelona. Save for shopping malls. Gasp!
  • There are over fifteen Michelin-star rated restaurants in Barcelona. Make sure you get bookings in up to two weeks in advance. Many finer restaurants also have tasting menus (which really are set menus, IMHO).
  • Beware the Ramblas area. Plenty of places tell you, you can get three tapas and a drink for a certain sum of money, but the tapas is always limited to what they choose, and the drink tends to be really small. In Barcelona you pay for your tapas, it doesn’t come for free when you order your drink. Don’t be fooled by paella on the streets either — ask what you’re getting (chicken paella is quite a common set menu dish). I found it a nice street to walk on, but eating I picked elsewhere.
  • On a Saturday night, within a 10km radius of the Ramblas area, the most popular destination checked-in on Foursquare had 14 people. Not a huge number by any means. Recommendations are mostly in Spanish on the service, so it proved to be hard to decipher for me.
  • Finding WiFi is not really common. Of course around the touristic areas many places offer up wifi with a drink.
  • Cava is common. Its like Spanish champagne/bubbly. It is also cheap. Don’t hesitate to ask for a glass before lunch/dinner.
  • Cafe Zurich at the end of Ramblas is a very nice place to sit and people watch. In fact people sit in a Parisian fashion looking towards the street.
  • There’s a market in the middle of the Ramblas area. Reminds me of Queen Victoria Market in Melbourne. They even give you a map. Very colourful, nice to take pictures of, and clearly its a destination in itself.
  • Television here is all pretty much Spanish-based. English shows dubbed in Spanish. There usually is some variant of CNN or BBC though for an English-language fix.

Notes from Sao Paulo, Brazil

This is my first time in Sao Paulo, Brazil. In fact, it is my first time in Brazil. Why not throw in the fact that it is my first time on the continent of South America? Some quick notes/observations:

  • The people are toothsome. I’m told that lots of Miss Universe/World’s come from Brazil, and its possibly quite true. You’re also told to explore areas like bars/clubs and drop in “where the beautiful people are”.
  • Sao Paulo is very multi-cultural. Its very easy to blend in, till someone speaks to you in Brazilian-Portuguese.
  • In this market, you need Brazilian-Portuguese. The bookstores are filled with titles. Going to large malls and speaking to wait staff is a challenge if you only speak English. Taxi drivers speak no English, so be prepared ahead of time.
  • The language is important, so there are always simultaneous translators when you give presentations.
  • Traffic jams are redefined here. Sitting in a car for two hours, when the journey really should take fourty-five minutes is quite common. Helicopters are generally available (as are helipads), and there are plenty of options for getting armored cars are.
  • There’s plenty of Brazilian fashion brands that we never see overseas.
  • I had a meal at Bob’s. It reminded me of a local McDonalds. Their website points to Twitter, Facebook and Orkut. Yes, Orkut is still a fairly used social network in Brazil. Only in Brazil (previously also in India, but I think Facebook has killed it there).
  • Nokia’s are big in Sao Paulo. Followed by Android-based devices. There are plenty of accessories for iOS devices (iPhones/iPads) in higher end malls (I noticed 2 push carts in one mall, for example), but they don’t seem as prevalent in terms of usage. There are Apple Premium Resellers as well.
  • K-POP videos are being used to sell TVs here in Sao Paulo.
  • There are really good concert acts happening in Sao Paulo (via Time Out Sao Paulo). Cities like Kuala Lumpur/Singapore can learn a lot from them.
  • HSBC is really here.
  • The Interlagos F1 Grand Prix happens here too. It is a pity I’m here a week earlier and won’t get to catch the F1.
  • Sao Paulo will be one of the host cities for the World Cup 2012 while Rio gets the Olympics in 2016 (save for some soccer matches which will also be in Sao Paulo). Infrastructure and language is going to be interesting for this.
  • People are very civic conscious and clean up after themselves (in fast food joints, after their dog poos, etc.).
  • Jardines area is definitely very pet friendly — see plenty of dogs walking around. It is also human friendly, less cars on the street. However it is hilly, so if you have a pram, it is not impossible but you have to be careful with negotiating the sidewalks.
  • Cycle friendly Sao Paulo is.

Food in Brussels

Barbar at Delirium in Brussels. Thousands of beers in-store! It was my first time to Brussels, Belgium. I found some amazing food that I’d go back to on a regular basis on future trips to Brussels. Most of everything is in the Grand Place area.

Scheletema has been around since 1972. They serve high quality food. Try their steak (filet mignon). Try their tuna. They have awesome scallops for a starter. Their menus can also be relatively good value for money.

Brussels is famous for “moules et frites” (mussels & fries). Visit Chez Leon. Its always crowded, has been around since 1893, and they have excellent mussels. Their Leon beer isn’t too bad either.

Want beer? Check out Delirium Cafe. Its in the Guinness Book of Records for holding over 2,000 beers in stock. Their tap beers are awesome too. I’ve quite enjoyed Barbar.

Waffles are available everywhere. For tradition, visit Le Funambule Waffles, which is near to Manneken Pis. They’ve been around since 18xx.

Fries are also everywhere, be sure to try out many of the sauces.

La Fourchette du Printemps

Beautiful quaint little restaurant at Rue du Printemps, nearby the Wagram metro station. It has one Michelin star. Lunch tasting menu is 45 euros a pop (February 2012) – starter, main course, desert. They also give you a pre-starter (free) plus a pre-desert (free). They close for lunch at 2pm, but entertained us right till 3.30pm – brilliant service. Chocolate desert for presentation was absolutely amazing – worth taking a video snapshot in-memory. Main course was out of this world. Definitely worth paying a visit; all credit cards (visa/master/amex) accepted.

Managing MySQL with Percona Toolkit by Frédéric Descamps

Frédéric Descamps of Percona.

Percona Toolkit is Maatkit & Aspersa combined. Opensource and the tools are very useful for a DBA.

You need Perl, DBI, DBD::mysql, Term::ReadKey. Most tools are written in Perl, and whatever is in Bash is being re-written in Perl. There is also a tarball or RPM or DEB packages.

Know your environment. The hardware & OS are crucial for you to know. How much memory/CPU do you use? Do you use swap? Is this a physical/virtual machine? Do you have free space? What kind of RAID controller? Volumes? Disk? What about the network interfaces? What IO schedulers are used? Which filesystem is the data stored on? To answer all that, just use pt-summary.

Know your MySQL environment. Version? Build? How many databases? Where is the data directory? What about replication? What are key InnoDB settings? Storage engine in use? Index type? Foreign keys? Full text indexes? To answer all this and more use pt-mysql-summary.

pt-slave-find shows you the topology and replication hierarchy of your MySQL replication instances. An inventory of replicas!

Where is my disk I/O going? Use pt-diskstats which is an improved iostat. There is pt-ioprofile but it can be dangerous in production.

Now its time to get more intimate with your database. Let’s try to find the answer to these questions: how are the indexes used? Are there duplicate keys? Which queries are eating most of the resources? You can use pt-duplicate-key-checker to check for duplicate/redundant indexes or foreign keys. pt-index-usage can tell you which indexes are unused. If you think you have bad SQL, check out pt-query-advisor.

You can use pt-query-digest to analyze the slow query log and show a profile of the workload. You mostly use this with slow query logs & tcpdump’s. Be careful when you have dropped packets — results may tend to be fake then!

After all this, its time to maintain your environment.

pt-deadlock-logger checks InnoDB status to log MySQL deadlock information. It needs to run continually to capture things.

pt-fk-error-logger extracts and logs MySQL foreign key errors.

pt-online-schema-change to alter tables. It makes a “shadow copy” and swaps them. Extremely useful for large, long-running ALTER. Facebook uses the same technique.

Validate your upgrades as upgrades are the leading cause of downtime. Are queries using different indexes? Is query execution plan different? New errors? See pt-upgrade for this. Best to run this on a third machine (i.e. the old machine and a new machine to see how it goes).

Verify replication integrity – pt-table-checksum. Perform an online replication consistency check or checksum MySQL tables efficiently on one or many servers. Use it routinely (mandatory for 95% of MySQL users). Put it in a weekly crontab. Repair differences with pt-table-sync.

Repair out-of-sync replicas – pt-table-sync

Measure delay acfurately – pt-heartbeat

Deliberately delay replication – pt-slave-delay

Watch & restart MySQL replication after errors – pt-slave-restart

When there are problems, get the symptoms when it hurts. Look at pt-stalk (wait for a condition to occur them begin collecting data – eg. everytime the threads go over 2,000 you have a problem, so it collects stuff – it calls pt-collect), pt-collect (collect information from a server for some period of time), and pt-sift.

pt-mext looks at many samples of MySQL SHOW GLOBAL STATUS side-by-side. Default STATUS shows counter since the MySQL instances started. It is very helpful to see a delta of recent activity.

The future: pt-query-digest will do query reviews; pt-stalk will do “magical fault detection algorithm”. Its all opensource and its all on Launchpad at lp:percona-toolkit.

Replication features of 2011 by Sergey Petrunia

Sergey Petrunia of the MariaDB project & Monty Program.

MySQL 5.5 GA at the end of 2010. MariaDB 5.3 RC towards the end of 2011 (beta in June 2011).

MySQL 5.5 is merged to Percona Server 5.5 which included semi-sync replication, slave fsync options, atuomatic relay log recovery, RBR slave type conversions (question if this is useful or not), individual log flushing (very useful, but not many using), replication heartbeat, SHOW RELAYLOG EVENTS. About 2/3rds of the audience use MySQL 5.5 in production, with only 2 people using semi-sync replication.

MariaDB 5.3 brings replication features brings group commit in the binary log, which is merged into Percona Server 5.5. Checksums for binlog events which is merged from MySQL 5.6. Sergey goes in-depth about the group commit for the binary log. To find out a little more about MariaDB replication changes, see Replication in the Knowledgebase.

There are several implementations of group commit. Facebook started it, followed by MariaDB & Oracle. Percona 5.5 is GA so the feature is there, its not in MySQL 5.6 (yet?), and MariaDB 5.3 is where its at. Seems like the MariaDB implementation is the best so far – refer to the Facebook benchmark performed by Mark Callaghan.

Annotated RBR poses a compatibility problem. MariaDB 5.3 has annotate_rows, while MySQL 5.6 has rows_query event. They are different events. So you cannot have a MariaDB 5.3 master and a MySQL 5.6 slave at this moment. So MySQL 5.6 will have a flag to mark “ignorable” binlog events which will be merged into MariaDB and this will make binary logs compatible again.

There is now also optimized RBR for tables with no primary key.

MySQL 5.6 also has crash-safe slave (replication information stored in tables). Crash-safe master (binary log recovery if the server starts & sees the binary log is corrupted). Parallel event execution is something that is new in MySQL 5.6 which is the most important feature for Sergey.

Pre-heating: There is mk-slave-prefetch (famous quote: “Please don’t use mk-slave-prefetch on #MySQL unless you are Facebook.”). There is replication booster by Yoshinori Matsunobu. There is a Python version of mk-slave-prefetch that Facebook uses.


i