Using Mixpanel API In Google App Engine Applications (Python)

We started using MixPanel to get realtime statistics on user engagement in our application. We’ve been using MixPanel before for funnel tracking, but you can’t really appreciate their service until you start using their event tracking. It is truly realtime (as advertised) – the second the user performs an action on your application, you see it on your dashboard.

Besides the realtime reporting what I really like about MixPanel is the fact that they allow easily reporting from your backend and not only from frontend/Javascript (as opposed to Google Analytics).

Within their documentation they have code samples in many languages, including Python. But their Python sample requires ability to start new processes on the server you’re running – something not possible on App Engine. Therefore I changed it to use URLFetch in RPC mode (so that calls to Mixpanel won’t block the call):

It could be re-factored more, like allowing setting the project token outside the function call, but that I will leave for you to do :) (and if you do, please share with us)

Arik

The Benefits of Using Amazon EC2

Amazon Elastic Compute Cloud, also known as “EC2″, allows scalable deployment of applications.[1] Current users are able to create, launch and terminate server instances on demand, hence the term “elastic”.(Wikipedia)

I believe that the Amazon Web Services (and especially EC2) are one of the most influencing technologies that shape the future of the web. While for me it’s pretty obvious what is the benefits of such a service, it sometimes difficult to explain to others. Yesterday, I stumbled over the most convincing example of them all.

Enter Animoto. Animoto is a cool web application that you feed it with your photos and it creates you a video of it (see example above). The geeks among you readers, know that rendering video can be CPU consuming. So how they do that? Using Amazon EC2, of course.

animoto_ec2_usage

During last week Animoto userbase grew from 25,000 users on Monday to 250,000 users on Thursday (!). But the graph the you see above isn’t the graph of their user count, it’s the graph of the EC2 instances they used to handle that traffic. They started the week with 50 EC2 instances, grew to 100, 900 and eventually 3400 instances of EC2. Later on when the demand lowered, you can see the the count lowered to something like 1200 EC2 instances.

Now imagine if they have been using regular servers. Just thinking of the meaning of managing all this amount of hardware, of storing it, DRP plans, etc.. gives me the creeps!

This example shows perfectly the benefits of EC2 in particular and cloud computing in general:

  • Pay as you go – you need 50 servers today? No problem. You need 3000 tomorrow? That’s no problem either. And the day after tomorrow you want only 1000? Just do what ever you want. No need to plan ahead of how much computing power you will need, just build the infrastructure that can grow.
  • No system management overhead – I guess that most of the EC2 instances used by Animoto are servers that do the video rendering. So when the usage grows that just duplicate the same server image they already have. When one of them stuck or fails, they just shut it down and start a new one. No need to have people maintaining huge server sites, buying hardware and stuff. Simple example for such an architecture using EC2 is explained in this article.
  • Simple! Everything is API based, and you’re not the first one to use it, so there plenty of implementions of scalable architectures over EC2 .
  • DRP? In a few mouse clicks (or automatically using a watchdog script that monitors their health dashboard) you can turn on a new instance at the European data center, and forward all you traffic from the US one there. More DRP than that?

I’m a total believer in cloud computing. I was really happy to see that Google entered the game, and I hope that other major players will join too (Microsoft, what are you waiting for?).

Arik