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.

MySQL Creatively in a Sandbox by Giuseppe Maxia

Giuseppe Maxia of Continuent and long time creator of MySQL Sandbox.

Only works on Unix-like servers. Works with MySQL, Percona & MariaDB servers. MySQL server has the data directory, the port and the socket – you can’t share these.

To use it: make_sandbox foo.tar.gz. Then just do ./use.

$SANDBOX_HOME is ~/sandboxes. You can also create ~/opt/mysql/ and if you have MySQL 5.0.91 binary in that directory, you can just do “sb 5.1.91”.

Sandbox has features to start replication systems as well. You can have varying master/slave setups with varying versions as well (good idea to test from MySQL -> MariaDB master->slave for migration).

You can now also play with tungsten-sandbox, which is a great way to start playing with Tungsten Replicator (see documentation and tungsten-toolbox). There is apparently also a MySQL Cluster sandbox tool that someone is working on.

 


i