Finding the HTML5 localStorage file on OS X and Windows 7

Just a quick tip if you’re ever doing iPhone development with the iPhone Simulator in Max OS X.

If your webapp is using HTML5 localStorage, then you can find the SQLite file available for your review by navigating to:

[UserName]\Library\Application Support\iPhone Simulator\[iPhone OS Version]\Library\WebKit\LocalStorage\[url].localstorage

You can then quickly drag and drop it onto the SQLite data browser for your viewing pleasure.

On Windows 7 with desktop Safari, you can do the same thing by going to:

C:\Users\[UserName]\AppData\Local\Apple Computer\Safari\LocalStorage\[url].localstorage

jQuery Example: Selecting items with drag and drop

Some time ago, I needed to take a list of items and select from them a subset, put that subset of items into a particular order, and then submit them to the server. A good example would be when you have a list of posts and you need to choose which ones (and in which order) you want to print them. Drag and Drop is a breeze with jQuery and jQuery UI.

Here is a video of it in action:

This was very easy to do with just a small amount of code. Here is the setup:

…and the code:

Once you’ve selected your items, it’s just a matter of POSTing the #postOrder input element to your server with a list of the IDs and their corresponding order.

Demo: Selecting items with drag and drop

RSS Tidbits for March 27th, 2010

Some thoughts on Media Temple

Some thoughts after 2.5 years of being with Media Temple. This is the opinion of a random person on the internet, so take it as such.

Media Temple is about resources, not performance

Media Temple is about resources, not performance. The (gs) service has never been speedy. Consistent, but never speedy. Kernel upgrades and hardware issues aside, the (gs) is never going to win any awards for performance. Resources are where they really stand out though. I’ve used as much as 1.66 TB of bandwidth and 500+ GPUs  in a billing cycle and I didn’t get overcharged for it. Perhaps they realized that it was in support of OSS, but who knows. Many of the hosts I’ve used over the years would have charged me significant amounts or kicked me off of their service for that. I agree with their stance that their (gs) service can absorb a lot of traffic. I’ve hit Digg and StumbleUpon a few times, and the service stayed up without a hitch.

Once you get over drooling on said resources though, you quickly realize that they can nickel and dime you to the poor house pretty quickly.

  • $20/month for the (gs) with 100GB of storage and 1TB of bandwidth
  • +$20/month for a mySQL container
  • +$20/month for a Django container
  • +$20/month for a RoR container

You wake up one day to realize that you can buy a WHM/cPanel virtual server, or even lightweight dedicated box, for that amount per month.

For comparison, Web Faction mid-high tier plan

  • $24.50/month for the ‘Shared 3′ plan with 40GB of storage and 1.8TB of bandwidth
  • mySQL
  • RoR
  • Zope/Plone
  • Pylons
  • Python 2.3, 2.4, & 2.5
  • Django
  • CherryPy
  • Turbo Gears
  • Mercurial
  • RoR
  • … all of the custom software, tweak custom compiles, and routing a developer could need without having to use a VPS or Dedicated server.

You’ve seen my comparison of performance. Now, is it going to survive a Digg, Slashdot, or Stumble? Who knows, but what are the chances of that happening again. If it doesn’t, I’m not that concerned. I’ll take a high performance, feature rich server over a 0.01% chance that it’ll get hit with a (what is essentially a DDoS) Slashdotting.

Performance is a feature

Media Temple marketing would be a failure if they tried to sell with a “slow, but steady” moniker on their service, but it really encapsulates what the (gs) is as a hosting service. Since I moved to Web Faction, I’ve had to resist the urge to drop into the (mt) forums and make a big deal about it. That desire comes from their insistence by them that my site gets a low grade from ySlow, so the performance problem is mine, not theirs. Use a CDN they said, add more compression, use less graphics, etc. I think the graph shows exactly how an identical setup compares apples to apples and is very damning of their opinion. Their finger pointing, while never missing a chance at an up-sell to a mySQL container, has left an accumilation of bad tastes in my mouth.

Speed is important to me, and Google seems to agree. I wrote my own browser start page application in WordPress awhile back and I see that page every time my browser starts. If I’m loading it 50 times per day and it takes six seconds, that’s 5 minutes of productivity that I’ve lost. That may not seem like a lot to some, but it’s very significant to me. Time is money, and (mt) is expensive in this manner.

Buzzword Compliant (or, why is the (gs) so slow)?

Short answer: It’s slow because of the resources.

(mt) originally used BlueArc servers as the Gen 1 (gs) storage hardware and it was a disaster. If I remember correctly, they were not planning on the transition to the Gen 2 storage platform until this year, but last years events accelerated that from “evaluation” to “emergency deployment” overnight. Storage is slow, especially on the scale the (mt) has it. They essentially created a hybrid of RAID 0/1/JBOD and attached it to the network on what I can only guess it at a huge scale. This is all well and good, but it makes your requests slow (as you’ve noticed!). Here’s my theory:

Let’s load a page from WordPress….

  1. Apache servers on Debian Linux take your http request that was routed to them by DNS
  2. Memcached tables locate the cluster and herd (segment, they are know internally has a herd) of your accounts
  3. Holding onto the request, it’s passed to the Sun storage server where the file is retrieved and executed.
  4. If mySQL is involved, then the request is passed through the intranet to either the SmartPool v2 or mySQL virtual machines.
    * Django and RoR containers are also symlinked to your account, but reside on separate physical hardware just like mySQL. Hence, those requests are even slower if they use the mySQL backend
  5. All of this gets passed back to Apache and served back to the client

The segmentation that is the strength of their resources is the Achilles heal of their performance. They have recently started a program to increase the amount of RAM on the SmartPool servers, but I think I bailed before getting a chance to benefit from any improvements there.

Not even the Magic 8 ball likes Microsoft. You shake it and it says ‘Outlook not so good’. (On the future of Media Temple)

Media Temple is always looking to the future. They have been beta testing Ubuntu bare (dv)s, a CDN system, OS X Server VPS, and other various products.  The (cs) or Cluster Server has been touted as the replacement for the instability and slow features of the (gs) for about as long as I’ve been a customer. I think it’s already here. While clusters 1 – 4 resolve via DNS to gridserver.net, clusters 5 and 6 resolve to clusterserver.net. It is my [unfounded and highly speculative] theory that the (cs) is a lie [ok, maybe not, but I’m a geek and a chance at using a meme rarely passes]. The (cs) has already been partially [mostly?] implemented and it’s a failure. It’s an small evolutionary step towards a better experience, but is not the silver bullet that (mt) hoped for, or in my opinion, needed.

Media Temple has a good thing going. They are highly successful in a field filled with hundreds of competitors that are indistinguishable from each other . They are where the ‘cool kids’ go to get hosted. They have built a certain buzz around there brand that few others have in that industry. C’mon, hosting is supposed to be a boring business. Hours of boredom punctuated with the occasional downtime. Somehow, they’ve got their ‘cool’ down to a science.

In the end, it doesn’t really matter (h/t to Linkin Park)

At the end of the day, I just want a host that I don’t have to think about. I’ve expended too much energy these last few years fighting with Media Temple (you should have heard some of my calls with the VPs, etc) about their products, trying to help other customers in the forum (there have been some ugly fights), and generally worrying about my sites. They’re fired. Time will tell if it continues, but I’ve put my 20+ sites onto Web Faction, I’m gonna get my billed paid automatically, and if I never have to think about them again, I’m okay with that. That’s the way it should be. Website hosting should be there when I want it, not because it needs me.

Update #1

Not long after I wrote this, I saw several more reports that the performance of the (gs) can vary wildly depending on which cluster you are on. Some (mt) customers we’re complaining about their segment when another user piped in that he had no problems with his cluster. Here’s my response to that:

Having a good experience as an (mt) customer should not have anything to do with being lucky enough to get on a particular cluster.

Update #2

Someone asked me “why does it seem like my site performance will be going fine, then have a few spikes of poor performance, then return to normal”.

My response:

I have a theory and will grasp for a good analogy. We’ll call it a “Q&A session”. Let us say that you are a speaker at a conference. In front of you is a group of 100 people, all wanting to ask you questions. So you can hear them, they move to the front of the room/pack. Once there, they can get your attention, ask a questions, and get a response. If they continue to ask questions, they will stay at the front of the room and continue to get them answered quickly. When they stop asking questions, they are slowly moved to the back of the room. If, after a time lapse, they decide to ask a question again, they must make their want back to the front of the room for you to hear them and answer the question. The trip from the back to the front takes time.

Now, as this relates to Media Temple. I’ve seen cases, especially with a mySQL container, where if my sites gets 0 traffic for a few hours, that first hit or two will take ~5-8 seconds (or longer), and subsequent hits will be < 1 second. This performance stays steady until the site stays idle for awhile and then “moves to the back of the room”. I’m not the only one, I’ve seen very similar complaints in the (mt) forum. It is almost as if the mySQL VM hibernates, not all that differently from your desktop/laptop.

See also: Goodbye Media Temple, hello Web Faction