Microsoft’s PHP Projects

On Wednesday Microsoft announced the release of PHP SDK for Windows Azure. It’s a set of classes providing access to Azure platform, that supports cloud storage, cloud computing, queue service, and management of the virtual boxes you’re renting from Azure. The PHP client, that comes complete with a set of PHPUnit tests, is available for checkout here. A quick look around Codeplex site shows a few other PHP projects that are either developed by Microsoft, or commissioned/funded by them and developed by somebody else:

  • Silverlight PHP – PHP access to Silverlight objects. The download, however, is a Visual Studio solution.
  • PHP Site Generator – a simple CRUD form builder. Helps if you’ve got a a table (one on SQL Server, looks like) an need to give some users access to create, retrieve, update, and delete the data – the site generator builds out all those forms for you.
  • PHP client for Virtual Earth – supports both SQL Server and MySQL for backend.
  • Web Slices and Accelerator for IE 8 – more a set of tutorials in PHP than a single complete client solution, but some pretty basic stuff, for example, an IE-compatible slice that pulls Facebook status.
Leave the first comment

Notes from Percona performance conference

I spent two days last week at Percona Performance Conference – a free event that took place parallel to MySQL User Conference & Expo at Santa Clara Convention Center. The content was good, and the organizers packed an impressive amount of 51 presentations, a sessions of lightning talks, and two open Q&A sessions towards the end of day, into 24+ hours over 2 days.

In lieu of Sun acquisition by Oracle, there was a lot of conversation regarding where MySQL is headed. Michael (Monty) Widenius outlined three directions Oracle could take with MySQL: abandon, sell, embrace, and at Percona conference was giving more details on Maria storage engine for MySQL, which looks a lot like InnoDB storage engine, with a new type of indexes.

Here’s a rundown of the sessions I attended with a possible link to slides where available (many slides are in PDF):

  • Return of Gearman – by Eric Day – Gearman is a “manager” server, assigning work to other available boxes, and coordinating the work between clients and workers (servers), so that clients can be unaware of the server pool, and send their requests directly to Gearman. Introducing this extra tier allows then for scaling out the server pool. Gearman also has a variety of native clients and fast protocols (few more presentations from Eric Day).
    Simple Gearman Cluster
  • Object-Oriented CSS – Nicole Sullivan presented an overview of the project. Contrary to the advertised name, it’s not a project to make CSS behave as expected, but more of a framework to ensure the same behavior of various grids, templates and modules across different browsers.
  • Fighting MySQL replication lag – from Peter Zaitsev from Percona. Some pretty useful tips, such as running heavy-duty jobs (ALTER TABLE) directly on the slaves, and reconsidering hardware options for slaves.
  • Scaling with Postgres – from Robert Treat – I was surprised at the quantity and quality of Postgres presentations at Percona conference. Having never dealt with Postgres in production, I don’t really have any good opinions on the presentations, but Robert’s slides provide a good deal of gotchas when scaling Postgres.
  • Balanced Patricia Tries – Moshe Shadmon from ScaleDB – a good overview of ScaleDB, where it’s useful, and how it uses tries. It’s an interesting proprietary storage engine.
  • Working with disk arrays – by Paul Tuckfield – first DBA at YouTube, and also first DBA at Paypal.
  • Using proxy architectures – by Robert Hodges – was a pretty in-depth look at proxy architectures and some pitfalls.
  • EMT Performance Monitoring – from my former colleague at Yahoo! Eric Bergen, now at Proven Scaling – EMT is a script for data collection and aggregation that Proven Scaling found useful to have on their clients’ boxes to get up-to-the-minute view of what exactly happened to the machine right before collapsing.
  • Proactive Operational Measures – from Nicklas Westerlund and Augusto Bott – more like an overview of what could potentially go wrong when you’re tasked with the operations side of things.

I didn’t go to presentations about CouchDB, Amazon cloud recipes, and exploring new hardware (flash memory, multi-core processors) for database servers, but glad to see the authors posting the content of those.

Second day of Percona Conference:

  • Disruptive innovations in open source – or where do we go from here in regards to MySQL from Baron Schwartz of Percona
  • Performance instrumention – from Cary Millsap – has some pretty good stories even if you know nothing about databases. Such as: don’t ever ask people what the most common performance problems are, since then you’re likely to be led astray. Manuals are very likely to suggest One True Solution for any performance problems, but if you flip through the pages, you will find out there are many One True Solutions to similar sounding problems. Optimization of subsystems might still be useless, when the process on top is broken and un-optimizable.
  • Pushing the envelope – by Don MakAskill of SmugMug – Don has to store pretty large amounts of data (raw photos in tens of megapixels) for paying clients, and the presentation covered SmugMug experience.
  • Internals of InnoDB disk I/O by Mark Callaghan of Google (slides are posted on his blog)
  • Hive – distributed data warehousing at Facebook – Hive has been open-sourced by my employer, and it’s a pretty useful layer if your data lives in Hadoop, but you cannot get everyone at the company to run map/reduce jobs. Ashish’s and Prasad’s presentations provides an overview of what Hive is. It’s also one of the few Facebook projects written in Java.
  • Multi-terabyte install of Postgres – pretty impressive from Theo Schlossnagle
  • Efficient pagination from Surat Bhati of Yahoo! – every Web developer probably dreads the moment when the pagination code generates something to the extent of SELECT * FROM images LIMIT 1000000,10. Yeah, it’s very unlikely the user will actually browse past the first million images, and Surat’s presentation primarily dealt with the ways of building interfaces around avoiding such queries. Spoiler alert: use Previous and Next, don’t link pages directly, most of the users don’t care about exact counts, and are perfectly fine with seeing “thousands” and “millions”, not “Comments 13,300 – 13,400 of 15,635,611”
  • High performance MySQL on a limited hardware budget from Percona

I didn’t see: Hypertable, PostgreSQL trees, Zawodny’s search at Craigslist, InnoDB tuning, common mistakes, non-disruptive backups, high-performance Erlang, and tuning MySQL replication, but thankfully those are online.

A few more cool things: MySQL User Conference has videos of selected presentations posted at blip.tv, I didn’t watch all, but started wathing Don MakAskills’s on SmugMug Tale, and since he didn’t post the slides, that’s the best way to get his presentation. There’s also a full range of presentations from MySQL Conference 2009 available at the conference site.

Jeremy Zawodny posted MySQL and Search at Craigslist on SlideShare, they’re a Sphinx shop, going from 25 MySQL MyISAM FULLTEXT boxes to 10 Sphinx boxes:

Giuseppe Maxia posted presentation on MySQL 5.1 partitions:

Robert Hodges posted slides on Tungsten SQL Router, Tungsten replication and using Tungsten with RightScale.

Kazuho Oku shared experience on building a real-time stats service on top of MySQL (Pathtraq is one of the largest in Japan):

as well as slides on building a reliable message queue service, Q4M:

At MySQL Conference, Anders Karlsson did a talk on using libmysqld inside your application:

MySQL High Availability presentation from MySQL and bwin games:

MySQL 5.1 Event Scheduler:

Running multiple MySQL servers on one box:

MySQL query manipulation slides from Kay Roepke.

Leave the first comment

Product positioning ouch

From Netflix description of Another Cinderella Story:

Another Cinderella Story

The official description mentions “dropping her iPod”, while in the movie it’s clearly Zune. Emphasized a few times by characters referring to the player as “Whose Zune is it?”, “What’s in your Zune playlist, girl?”, etc. Can imagine there were some calls between the producers and Zune product placement team.

Leave the first comment

Bret Taylor on how FriendFeed uses MySQL

Bret Taylor from FriendFeed presented today at San Francisco MySQL meetup on how FriendFeed uses MySQL. If you’ve read Bret’s blog post previously, the presentation itself wasn’t news, but the Q&A session was pretty good. A few interesting takeaways:

  • For replication FriendFeed relies on MySQL replication, and it works quite well
  • They did try document storage systems, including Couch DB, but none proved to be mature enough for production deployment
  • They’re aware that a write might take longer than usual in this two-phase commit scenario, but they don’t need to present the data in real-time right away – a delay of a few seconds is acceptable for the users
  • Some users tax the existing index system by following 30,000 friends on FriendFeed
  • Failover is done manually most of the time – from Bret’s experience with Google and FriendFeed, a babysitter script for automatic failover tends to introduce issues
  • There are some new sorting parameters ready to be pushed out for FriendFeed, and for each new sorting parameter FriendFeed creates a new set of indexes – there’s never ORDER BY in any of the queries
One comment so far, add another

Quick CSS-based grids with Blueprint CSS

Blueprint CSS is a pretty quick way to design complex grids with CSS. The idea is basic – include the necessary styles, and you get a container for your site with fixed with of 960 px. So it’s not a universal solution, but at least if you’re comfortable with the width of 960, Blueprint will prevent you from giving up and using tables.

There are just 3 compressed CSS files to include, the third one is only for IE support.

<link rel=“stylesheet” href=“css/blueprint/screen.css” type=“text/css” media=“screen, projection”>
<link rel=“stylesheet” href=“css/blueprint/print.css” type=“text/css” media=“print”>
<!–[if IE]>
  <link rel=“stylesheet” href=“css/blueprint/ie.css” type=“text/css” media=“screen, projection”>
<![endif]>

Then a simple container div will give you a centered area 960 pixels wide:

  1. <div class=“container”>
  2.   I am a container.
  3. </div>

You can attach any of your own styles to that container div, so I had an extra class that painted the container silver for better visualization.Blueprint CSS example - a single container

Let’s say we are going to need a header, a footer, a narrow right sidebar, a narrow left sidebar, and wide area in the center for content. Blueprint provides you with a bunch of classes ranging from span-1 for 1 column to span-24 for full 100% width. So for a full-width header and footer we create the following markup:

<div class=“container”>
   <!– header –>
   <div class=“span-24 header”>
   </div>
   <!– footer –>
   <div class=“span-24 footer”>
   </div>
</div>

What about the content area with 2 sidebars? With Blueprint CSS, your spans on one row have to equal to 24, so we can either do 1-22-1, or 2-20-2, or 3-18-3, and so on. 8-8-8 would get us a page equally divided into three divs. Let’s go the 2-20-2 route:

<div class=“container”>  <!– header –> 

  <div class=“span-24 header”>Header </div>

  <!– content>

  <div class=“span-2″>I am the left column</div>

  <div class=“span-20″>I am the main content area</div>

  <div class=“span-2 last”>I am the right column</div>

  <!– footer –>

  <div class=“span-24 footer”>Footer</div>

</div>

There’s another nuance to the markup above – the right sidebar has to have the last class. If I add some additional coloring to those divs, here’s a sample layout I’ve built with the code above:

Three - column layout with Blueprint CSSBut wait, there’s more. You can host divs inside divs without worrying about them overflowing. Let’s say we wanted to make the right column wider, up to 10 columns, which would make the central column become a span-12. And inside that right sidebar that’s a span-10 we wanted to host 2 divs per line, span-5 each, perhaps displaying an image, or a square ad. You can host two span-5 divs inside a span-10, or even a span-10 ad inside a span-10:

<div class=“container”>
   <!– header –>
   <div class=“span-24 header”>Header</div>
 
  <!– content>
   <div class=“span-2″>I am the left column</div>
   <div class=“span-12″>I am the main content area</div>
   <div class=“span-10 last”>
     <div class=“span-10 last”>Ads</div>
     <div class=“span-5″>I am some kind of ad</div>
     <div class=“span-5 last”>I am some kind of ad</div>
     <div class=“span-5″>I am some kind of ad</div>
     <div class=“span-5 last”>I am some kind of ad</div>
     <div class=“span-5″>I am some kind of ad</div>
     <div class=“span-5 last”>I am some kind of ad</div>
     <div class=“span-5″>I am some kind of ad</div>
     <div class=“span-5 last”>I am some kind of ad</div>
   </div>

  <!– footer –>
   <div class=“span-24 footer”>Footer</div>
</div>

With some colorful background we get this grid:
Alternating ads in a sidebar with Blueprint CSS

There’s a pretty good quickstart tutorial on Blueprint github Wiki page. There’s also an example page that implements a somewhat complicated grid:

A sample page grid with Blueprint CSS

Leave the first comment